PHP Класс Bravo3\Orm\Services\EntityLocator

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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