mediatekformation

ReferenceRepository
in package

ReferenceRepository class manages references for fixtures in order to easily support the relations between fixtures

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
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
getIdentifier()  : array<string|int, mixed>
Get identifier for a unit of work
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 = []

$references

List of named references to the fixture objects gathered during loads of fixtures

private array<string|int, mixed> $references = []

Methods

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
throws
BadMethodCallException
  • if repository already has a reference by $name.
Return values
void

getIdentities()

Get all stored identities

public getIdentities() : array<string|int, mixed>
Return values
array<string|int, mixed>

getReference()

Loads an object using stored reference named by $name

public getReference(string $name) : object
Parameters
$name : string
Tags
throws
OutOfBoundsException
  • if repository does not exist.
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

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

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>

hasIdentifier()

Checks if object has identifier already in unit of work.

private hasIdentifier(string $reference) : bool
Parameters
$reference : string
Return values
bool

Search results