PHP Класс FactoryGirl\Provider\Doctrine\FixtureFactory

See the README file for a tutorial.
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$em Doctrine\ORM\EntityManager
$entityDefs array
$entityNamespace string
$persist boolean
$singletons array

Открытые методы

Метод Описание
__construct ( EntityManager $em )
defineEntity ( $name, array $fieldDefs = [], array $config = [] ) : FixtureFactory Defines how to create a default entity of type $name.
get ( $name, array $fieldOverrides = [] ) Get an entity and its dependencies.
getAsSingleton ( $name, array $fieldOverrides = [] ) A shorthand combining get() and setSingleton().
getEntityNamespace ( )
getList ( $name, array $fieldOverrides = [], $numberOfInstances = 1 ) Get an array of entities and their dependencies.
persistOnGet ( $enabled = true ) Sets whether get() should automatically persist the entity it creates.
setEntityNamespace ( $namespace ) Sets the namespace to be prefixed to all entity names passed to this class.
setSingleton ( $name, $entity ) Sets $entity to be the singleton for $name.
unsetSingleton ( $name ) Unsets the singleton for $name.

Защищенные методы

Метод Описание
addNamespace ( string $name ) : string
checkFieldOverrides ( EntityDef $def, array $fieldOverrides )
createCollectionFrom ( $array = [] )
setField ( $ent, EntityDef $def, $fieldName, $fieldValue )
updateCollectionSideOfAssocation ( $entityBeingCreated, $metadata, $fieldName, $value )

Описание методов

__construct() публичный Метод

public __construct ( EntityManager $em )
$em Doctrine\ORM\EntityManager

addNamespace() защищенный Метод

protected addNamespace ( string $name ) : string
$name string
Результат string

checkFieldOverrides() защищенный Метод

protected checkFieldOverrides ( EntityDef $def, array $fieldOverrides )
$def EntityDef
$fieldOverrides array

createCollectionFrom() защищенный Метод

protected createCollectionFrom ( $array = [] )

defineEntity() публичный Метод

See the readme for a tutorial.
public defineEntity ( $name, array $fieldDefs = [], array $config = [] ) : FixtureFactory
$fieldDefs array
$config array
Результат FixtureFactory

get() публичный Метод

Whether the entity is new or not depends on whether you've created a singleton with the entity name. See getAsSingleton(). If you've called persistOnGet() then the entity is also persisted.
public get ( $name, array $fieldOverrides = [] )
$fieldOverrides array

getAsSingleton() публичный Метод

It's illegal to call this if $name already has a singleton.
public getAsSingleton ( $name, array $fieldOverrides = [] )
$fieldOverrides array

getEntityNamespace() публичный Метод

public getEntityNamespace ( )

getList() публичный Метод

Whether the entities are new or not depends on whether you've created a singleton with the entity name. See getAsSingleton(). If you've called persistOnGet() then the entities are also persisted.
public getList ( $name, array $fieldOverrides = [], $numberOfInstances = 1 )
$fieldOverrides array

persistOnGet() публичный Метод

By default it does not. In any case, you still need to call flush() yourself.
public persistOnGet ( $enabled = true )

setEntityNamespace() публичный Метод

Sets the namespace to be prefixed to all entity names passed to this class.
public setEntityNamespace ( $namespace )

setField() защищенный Метод

protected setField ( $ent, EntityDef $def, $fieldName, $fieldValue )
$def EntityDef

setSingleton() публичный Метод

This causes get($name) to return $entity.
public setSingleton ( $name, $entity )

unsetSingleton() публичный Метод

This causes get($name) to return new entities again.
public unsetSingleton ( $name )

updateCollectionSideOfAssocation() защищенный Метод

protected updateCollectionSideOfAssocation ( $entityBeingCreated, $metadata, $fieldName, $value )

Описание свойств

$em защищенное свойство

protected EntityManager,Doctrine\ORM $em
Результат Doctrine\ORM\EntityManager

$entityDefs защищенное свойство

protected array $entityDefs
Результат array

$entityNamespace защищенное свойство

protected string $entityNamespace
Результат string

$persist защищенное свойство

protected bool $persist
Результат boolean

$singletons защищенное свойство

protected array $singletons
Результат array