abstract class PersistentCollection implements Collection (View source)

Persistent collection class.

Constants

INITIALIZED_NONE

INITIALIZED_FROM_COLLECTION

INITIALIZED_FROM_COLLECTION_FORCE

INITIALIZED_FROM_PHPCR

Properties

protected ArrayCollection $collection
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.
protected string $initialized Whether the collection has already been initialized.
protected DocumentManagerInterface $dm
protected string $locale

Methods

bool
changed()

No description

takeSnapshot()

Set the collection not 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.

Details

bool changed()

Return Value

bool Whether the collection was modified

takeSnapshot()

Set the collection not 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

abstract initialize()

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