class ReferrersCollection extends PersistentCollection (View source)

Referrer collection class.

This class represents a collection of referrers of a document which phpcr names match a optional name

Constants

INITIALIZED_NONE

INITIALIZED_FROM_COLLECTION

INITIALIZED_FROM_COLLECTION_FORCE

INITIALIZED_FROM_PHPCR

Properties

protected ArrayCollection $collection from PersistentCollection
protected bool $isDirty Whether the collection is dirty and needs to be synchronized with the database when the UnitOfWork that manages its persistent state commits. from PersistentCollection
protected string $initialized Whether the collection has already been initialized. from PersistentCollection
protected DocumentManagerInterface $dm from PersistentCollection
protected string $locale from PersistentCollection

Methods

bool
changed()

No description

takeSnapshot()

Reset original referrer paths and mark the collection as non dirty.

ArrayCollection
unwrap()

No description

add($element)

{@inheritdoc}

clear()

{@inheritdoc}

contains($element)

{@inheritdoc}

containsKey($key)

{@inheritdoc}

count()

{@inheritdoc}

current()

{@inheritdoc}

exists(Closure $p)

{@inheritdoc}

filter(Closure $p)

{@inheritdoc}

first()

{@inheritdoc}

forAll(Closure $p)

{@inheritdoc}

get($key)

{@inheritdoc}

getIterator()

{@inheritdoc}

getKeys()

{@inheritdoc}

getValues()

{@inheritdoc}

indexOf($element)

{@inheritdoc}

isEmpty()

{@inheritdoc}

key()

{@inheritdoc}

last()

{@inheritdoc}

map(Closure $func)

{@inheritdoc}

next()

{@inheritdoc}

offsetExists($offset)

{@inheritdoc}

offsetGet($offset)

{@inheritdoc}

offsetSet($offset, $value)

{@inheritdoc}

offsetUnset($offset)

{@inheritdoc}

partition(Closure $p)

{@inheritdoc}

remove($key)

{@inheritdoc}

removeElement($element)

{@inheritdoc}

set($key, $value)

{@inheritdoc}

slice($offset, $length = null)

{@inheritdoc}

toArray()

{@inheritdoc}

string
__toString()

Returns a string representation of this object.

refresh()

Refresh the collection form the database, all local changes are lost.

bool
isInitialized()

Checks whether this collection has been initialized.

bool
isDirty()

Gets a boolean flag indicating whether this collection is dirty which means its state needs to be synchronized with the database.

setDirty(bool $dirty)

Sets a boolean flag, indicating whether this collection is dirty.

setLocale($locale)

Set the default locale for this collection.

initializeFromCollection(array|Collection $collection, bool $forceOverwrite = false)

No description

initialize()

Initializes the collection by loading its contents from the database if the collection is not yet initialized.

__construct(DocumentManagerInterface $dm, object $document, string|null $type = null, string|null $name = null, string|null $locale = null, string|null $refClass = null)

No description

createFromCollection(DocumentManagerInterface $dm, object $document, array|Collection $collection, string|null $type = null, string|null $name = null, string|null $refClass = null, bool $forceOverwrite = false)

No description

array
getOriginalPaths()

Return the ordered list of referrer properties that existed when the collection was initialized.

Details

bool changed()

Return Value

bool Whether the collection was modified

takeSnapshot()

Reset original referrer paths and mark the collection as non dirty.

ArrayCollection unwrap()

Return Value

ArrayCollection The collection

add($element)

{@inheritdoc}

Parameters

$element

clear()

{@inheritdoc}

contains($element)

{@inheritdoc}

Parameters

$element

containsKey($key)

{@inheritdoc}

Parameters

$key

count()

{@inheritdoc}

current()

{@inheritdoc}

exists(Closure $p)

{@inheritdoc}

Parameters

Closure $p

filter(Closure $p)

{@inheritdoc}

Parameters

Closure $p

first()

{@inheritdoc}

forAll(Closure $p)

{@inheritdoc}

Parameters

Closure $p

get($key)

{@inheritdoc}

Parameters

$key

getIterator()

{@inheritdoc}

getKeys()

{@inheritdoc}

getValues()

{@inheritdoc}

indexOf($element)

{@inheritdoc}

Parameters

$element

isEmpty()

{@inheritdoc}

key()

{@inheritdoc}

last()

{@inheritdoc}

map(Closure $func)

{@inheritdoc}

Parameters

Closure $func

next()

{@inheritdoc}

offsetExists($offset)

{@inheritdoc}

Parameters

$offset

offsetGet($offset)

{@inheritdoc}

Parameters

$offset

offsetSet($offset, $value)

{@inheritdoc}

Parameters

$offset
$value

offsetUnset($offset)

{@inheritdoc}

Parameters

$offset

partition(Closure $p)

{@inheritdoc}

Parameters

Closure $p

remove($key)

{@inheritdoc}

Parameters

$key

removeElement($element)

{@inheritdoc}

Parameters

$element

set($key, $value)

{@inheritdoc}

Parameters

$key
$value

slice($offset, $length = null)

{@inheritdoc}

Parameters

$offset
$length

toArray()

{@inheritdoc}

string __toString()

Returns a string representation of this object.

Return Value

string

refresh()

Refresh the collection form the database, all local changes are lost.

bool isInitialized()

Checks whether this collection has been initialized.

Return Value

bool

bool isDirty()

Gets a boolean flag indicating whether this collection is dirty which means its state needs to be synchronized with the database.

Return Value

bool TRUE if the collection is dirty, FALSE otherwise.

setDirty(bool $dirty)

Sets a boolean flag, indicating whether this collection is dirty.

Parameters

bool $dirty Whether the collection should be marked dirty or not.

setLocale($locale)

Set the default locale for this collection.

Parameters

$locale

protected initializeFromCollection(array|Collection $collection, bool $forceOverwrite = false)

Parameters

array|Collection $collection The collection to initialize with
bool $forceOverwrite If to force the database to be forced to the state of the collection

initialize()

Initializes the collection by loading its contents from the database if the collection is not yet initialized.

__construct(DocumentManagerInterface $dm, object $document, string|null $type = null, string|null $name = null, string|null $locale = null, string|null $refClass = null)

Parameters

DocumentManagerInterface $dm The DocumentManager the collection will be associated with.
object $document The parent document instance
string|null $type Type can be 'weak', 'hard' or null to get both weak and hard references.
string|null $name If set, name of the referencing property.
string|null $locale The locale to use.
string|null $refClass Class the referrer document must be instanceof.

static ReferrersCollection createFromCollection(DocumentManagerInterface $dm, object $document, array|Collection $collection, string|null $type = null, string|null $name = null, string|null $refClass = null, bool $forceOverwrite = false)

Parameters

DocumentManagerInterface $dm The DocumentManager the collection will be associated with.
object $document The parent document instance
array|Collection $collection The collection to initialize with
string|null $type Type can be 'weak', 'hard' or null to get both weak and hard references.
string|null $name If set, name of the referencing property.
string|null $refClass Class the referrer document must be instanceof.
bool $forceOverwrite If to force the database to be forced to the state of the collection

Return Value

ReferrersCollection

array getOriginalPaths()

Return the ordered list of referrer properties that existed when the collection was initialized.

Return Value

array absolute paths to the properties of this collection.