PHP 클래스 Bravo3\Orm\Services\EntityLocator

파일 보기 프로젝트 열기: bravo3/orm 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$entity_manager EntityManager
$normaliser callable

공개 메소드들

메소드 설명
__construct ( EntityManager $entity_manager = null )
getEntityManager ( ) : EntityManager | null Get the entity manager currently used for validation
getNormaliser ( ) : callable Get class normaliser
locateEntities ( string $dir, string $namespace, string $regex = '/^.+\.php$/i' ) : string[] Gather all entities in a given directory
setEntityManager ( EntityManager $entity_manager = null ) Set the entity manager, if null no entity validation will occur
setNormaliser ( callable $normaliser ) Set class normaliser

메소드 상세

__construct() 공개 메소드

public __construct ( EntityManager $entity_manager = null )
$entity_manager EntityManager

getEntityManager() 공개 메소드

Get the entity manager currently used for validation
public getEntityManager ( ) : EntityManager | null
리턴 EntityManager | null

getNormaliser() 공개 메소드

By default this will return a callback that will simply strip the file extension from the input. If you have a more complex filename structure you can account for it using the #setNormaliser() function (see docblock). However be aware that you're probably not PSR compliant if you need to do this.
public getNormaliser ( ) : callable
리턴 callable

locateEntities() 공개 메소드

Assumes PSR-0/4 compliant entity class names, and an appropriate auto-loader is installed.
public locateEntities ( string $dir, string $namespace, string $regex = '/^.+\.php$/i' ) : string[]
$dir string Directory to scan
$namespace string PSR base namespace for the directory
$regex string Filter for file matching
리턴 string[]

setEntityManager() 공개 메소드

Set the entity manager, if null no entity validation will occur
public setEntityManager ( EntityManager $entity_manager = null )
$entity_manager EntityManager

setNormaliser() 공개 메소드

This must be a callback that takes 1 argument and will return a string. Its purpose is to convert file names into class names, for example, "MyEntity.php" should return "MyEntity". It will only ever operate on the final segment of a namespace.
public setNormaliser ( callable $normaliser )
$normaliser callable

프로퍼티 상세

$entity_manager 보호되어 있는 프로퍼티

protected EntityManager,Bravo3\Orm\Services $entity_manager
리턴 EntityManager

$normaliser 보호되어 있는 프로퍼티

protected callable $normaliser
리턴 callable