ProxyReferenceRepository
extends ReferenceRepository
in package
Proxy reference repository
Allow data fixture references and identities to be persisted when cached data fixtures are pre-loaded, for example, by LiipFunctionalTestBundle\Test\WebTestCase loadFixtures().
Table of Contents
- $identities : array<string|int, mixed>
- List of identifiers stored for references in case if reference gets unmanaged, it will use a proxy referenced by this identity
- $manager : ObjectManager
- Currently used object manager
- $references : array<string|int, mixed>
- List of named references to the fixture objects gathered during loads of fixtures
- __construct() : mixed
- addReference() : void
- Set the reference entry identified by $name and referenced to managed $object. $name must not be set yet
- getIdentities() : array<string|int, mixed>
- Get all stored identities
- getManager() : ObjectManager
- Get object manager
- getReference() : object
- Loads an object using stored reference named by $name
- getReferenceNames() : array<string|int, mixed>
- Searches for reference names in the list of stored references
- getReferences() : array<string|int, mixed>
- Get all stored references
- hasIdentity() : bool
- Checks if reference has identity stored
- hasReference() : bool
- Check if an object is stored using reference named by $name
- load() : bool
- Load data fixture reference repository
- save() : mixed
- Save data fixture reference repository
- serialize() : string
- Serialize reference repository
- setReference() : mixed
- Set the reference entry identified by $name and referenced to $reference. If $name already is set, it overrides it
- setReferenceIdentity() : mixed
- Store the identifier of a reference
- unserialize() : mixed
- Unserialize reference repository
- getIdentifier() : array<string|int, mixed>
- Get identifier for a unit of work
- getRealClass() : string
- Get real class name of a reference that could be a proxy
- hasIdentifier() : bool
- Checks if object has identifier already in unit of work.
Properties
$identities
List of identifiers stored for references in case if reference gets unmanaged, it will use a proxy referenced by this identity
private
array<string|int, mixed>
$identities
= []
$manager
Currently used object manager
private
ObjectManager
$manager
$references
List of named references to the fixture objects gathered during loads of fixtures
private
array<string|int, mixed>
$references
= []
Methods
__construct()
public
__construct(ObjectManager $manager) : mixed
Parameters
- $manager : ObjectManager
Return values
mixed —addReference()
Set the reference entry identified by $name and referenced to managed $object. $name must not be set yet
public
addReference(string $name, object $object) : void
Notice: in case if identifier is generated after the record is inserted, be sure tu use this method after $object is flushed
Parameters
- $name : string
- $object : object
-
- managed object
Tags
Return values
void —getIdentities()
Get all stored identities
public
getIdentities() : array<string|int, mixed>
Return values
array<string|int, mixed> —getManager()
Get object manager
public
getManager() : ObjectManager
Return values
ObjectManager —getReference()
Loads an object using stored reference named by $name
public
getReference(string $name) : object
Parameters
- $name : string
Tags
Return values
object —getReferenceNames()
Searches for reference names in the list of stored references
public
getReferenceNames(object $reference) : array<string|int, mixed>
Parameters
- $reference : object
Return values
array<string|int, mixed> —getReferences()
Get all stored references
public
getReferences() : array<string|int, mixed>
Return values
array<string|int, mixed> —hasIdentity()
Checks if reference has identity stored
public
hasIdentity(string $name) : bool
Parameters
- $name : string
Return values
bool —hasReference()
Check if an object is stored using reference named by $name
public
hasReference(string $name) : bool
Parameters
- $name : string
Return values
bool —load()
Load data fixture reference repository
public
load(string $baseCacheName) : bool
Parameters
- $baseCacheName : string
-
Base cache name
Return values
bool —save()
Save data fixture reference repository
public
save(string $baseCacheName) : mixed
Parameters
- $baseCacheName : string
-
Base cache name
Return values
mixed —serialize()
Serialize reference repository
public
serialize() : string
Return values
string —setReference()
Set the reference entry identified by $name and referenced to $reference. If $name already is set, it overrides it
public
setReference(string $name, object $reference) : mixed
Parameters
- $name : string
- $reference : object
Return values
mixed —setReferenceIdentity()
Store the identifier of a reference
public
setReferenceIdentity(string $name, mixed $identity) : mixed
Parameters
- $name : string
- $identity : mixed
Return values
mixed —unserialize()
Unserialize reference repository
public
unserialize(string $serializedData) : mixed
Parameters
- $serializedData : string
-
Serialized data
Return values
mixed —getIdentifier()
Get identifier for a unit of work
protected
getIdentifier(object $reference, object $uow) : array<string|int, mixed>
Parameters
- $reference : object
-
Reference object
- $uow : object
-
Unit of work
Return values
array<string|int, mixed> —getRealClass()
Get real class name of a reference that could be a proxy
protected
getRealClass(string $className) : string
Parameters
- $className : string
-
Class name of reference object
Return values
string —hasIdentifier()
Checks if object has identifier already in unit of work.
private
hasIdentifier(string $reference) : bool
Parameters
- $reference : string