‪TYPO3CMS  ‪main
TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage:
TYPO3\CMS\Extbase\Persistence\ObjectStorage TYPO3\CMS\Extbase\Persistence\ObjectStorage TYPO3\CMS\Extbase\Persistence\Generic\LoadingStrategyInterface TYPO3\CMS\Extbase\Persistence\ObjectMonitoringInterface TYPO3\CMS\Extbase\Persistence\ObjectMonitoringInterface

Public Member Functions

 isInitialized ()
 
 __construct (object $parentObject, string $propertyName, mixed $fieldValue, ?DataMapper $dataMapper=null)
 
 addAll (ObjectStorage $storage)
 
 attach (object $object, mixed $information=null)
 
 contains (object $object)
 
positive int count ()
 
TEntity null current ()
 
 detach (object $object)
 
string key ()
 
 next ()
 
 offsetExists (mixed $value)
 
 offsetGet (mixed $value)
 
 offsetSet (mixed $object, mixed $information)
 
 offsetUnset (mixed $value)
 
 removeAll (ObjectStorage $storage)
 
 rewind ()
 
 valid ()
 
 toArray ()
 
 getPosition ($object)
 
 __serialize ()
 
 __unserialize (array $data)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
mixed getInfo ()
 
 setInfo (mixed $information)
 
list< TEntity > getArray ()
 
 _memorizeCleanState (?string $propertyName=null)
 
 _isDirty (?string $propertyName=null)
 
 isRelationDirty (object $object)
 
 getPosition (object $object)
 

Protected Member Functions

 initialize ()
 
 isStorageAlreadyMemorizedInParentCleanState ()
 

Protected Attributes

DataMapper $dataMapper
 
DomainObjectInterface $parentObject
 
string $propertyName
 
mixed $fieldValue
 
bool $isInitialized = false
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
array $storage = []
 
bool $isModified = false
 
array $addedObjectsPositions = []
 
array $removedObjectsPositions = []
 
int $positionCounter = 0
 

Private Attributes

string $warning = 'You should never see this warning. If you do, you probably used PHP array functions like current() on the TYPO3\\CMS\\Extbase\\Persistence\\Generic\\LazyObjectStorage. To retrieve the first result, you can use the rewind() and current() methods.'
 

Detailed Description

A proxy that can replace any object and replaces itself in its parent on the first access (call, get, set, isset, unset).

only to be used within Extbase, not part of TYPO3 Core API.

@template TEntity of object <TEntity>

Definition at line 35 of file LazyObjectStorage.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::__construct ( object  $parentObject,
string  $propertyName,
mixed  $fieldValue,
?DataMapper  $dataMapper = null 
)
Parameters
TEntity$parentObject‪The object instance this proxy is part of
string$propertyName‪The name of the proxied property in its parent
mixed$fieldValue‪The raw field value.

Definition at line 76 of file LazyObjectStorage.php.

Member Function Documentation

◆ __serialize()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::__serialize ( )

Definition at line 298 of file LazyObjectStorage.php.

◆ __unserialize()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::__unserialize ( array  $data)

Definition at line 308 of file LazyObjectStorage.php.

◆ addAll()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::addAll ( ObjectStorage  $storage)
See also
ObjectStorage::addAll

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 118 of file LazyObjectStorage.php.

◆ attach()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::attach ( object  $object,
mixed  $information = null 
)
Parameters
TEntity$object‪The object to add.
mixed$information‪The information to associate with the object.
See also
ObjectStorage::attach

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 130 of file LazyObjectStorage.php.

◆ contains()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::contains ( object  $object)
Parameters
TEntity$object‪The object to look for.
See also
ObjectStorage::contains

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 141 of file LazyObjectStorage.php.

◆ count()

positive int TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::count ( )

Counts the elements in the storage array

Exceptions
Exception
Returns
‪0|positive-int The number of objects in the storage.

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 153 of file LazyObjectStorage.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\count().

◆ current()

TEntity null TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::current ( )
Returns
‪TEntity|null The object at the current iterator position.
See also
ObjectStorage::current

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 169 of file LazyObjectStorage.php.

◆ detach()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::detach ( object  $object)
Parameters
TEntity$object‪The object to remove.
See also
ObjectStorage::detach

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 180 of file LazyObjectStorage.php.

◆ getPosition()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::getPosition (   $object)
Parameters
mixed$object

Definition at line 292 of file LazyObjectStorage.php.

◆ initialize()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::initialize ( )
protected

Lazily initializes the object storage.

Definition at line 91 of file LazyObjectStorage.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\addAll(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\attach(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\contains(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\count(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\current(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\detach(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\getPosition(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\key(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\next(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\offsetExists(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\offsetGet(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\offsetSet(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\offsetUnset(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\removeAll(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\rewind(), TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\toArray(), and TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage< TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Property\DummyEntityWithoutTypeDeclarations >\valid().

◆ isInitialized()

◆ isStorageAlreadyMemorizedInParentCleanState()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::isStorageAlreadyMemorizedInParentCleanState ( )
protected

◆ key()

string TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::key ( )
Returns
‪string The index corresponding to the position of the iterator.
See also
ObjectStorage::key

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 191 of file LazyObjectStorage.php.

◆ next()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::next ( )
See also
ObjectStorage::next

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 200 of file LazyObjectStorage.php.

◆ offsetExists()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::offsetExists ( mixed  $value)
Parameters
TEntity | int | string$value‪The object to look for, or the key in the storage.
See also
ObjectStorage::offsetExists

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 211 of file LazyObjectStorage.php.

◆ offsetGet()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::offsetGet ( mixed  $value)
Parameters
TEntity | int | string$value‪The object to look for, or its key in the storage.
See also
ObjectStorage::offsetGet

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 222 of file LazyObjectStorage.php.

◆ offsetSet()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::offsetSet ( mixed  $object,
mixed  $information 
)
Parameters
TEntity | string | null$object‪The object to add.
mixed$information‪The information to associate with the object.
See also
ObjectStorage::offsetSet

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 234 of file LazyObjectStorage.php.

◆ offsetUnset()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::offsetUnset ( mixed  $value)
Parameters
TEntity | int | string$value‪The object to remove, or its key in the storage.
See also
ObjectStorage::offsetUnset

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 245 of file LazyObjectStorage.php.

◆ removeAll()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::removeAll ( ObjectStorage  $storage)
Parameters
ObjectStorage$storage‪The storage containing the elements to remove.
See also
ObjectStorage::removeAll

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 256 of file LazyObjectStorage.php.

◆ rewind()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::rewind ( )
See also
ObjectStorage::rewind

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 265 of file LazyObjectStorage.php.

◆ toArray()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::toArray ( )
See also
ObjectStorage::toArray

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 283 of file LazyObjectStorage.php.

◆ valid()

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::valid ( )
See also
ObjectStorage::valid

Reimplemented from TYPO3\CMS\Extbase\Persistence\ObjectStorage.

Definition at line 274 of file LazyObjectStorage.php.

Member Data Documentation

◆ $dataMapper

◆ $fieldValue

mixed TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::$fieldValue
protected

◆ $isInitialized

bool TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::$isInitialized = false
protected

◆ $parentObject

DomainObjectInterface TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::$parentObject
protected

◆ $propertyName

◆ $warning

string TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage::$warning = 'You should never see this warning. If you do, you probably used PHP array functions like current() on the TYPO3\\CMS\\Extbase\\Persistence\\Generic\\LazyObjectStorage. To retrieve the first result, you can use the rewind() and current() methods.'
private

This field is only needed to make debugging easier:

If you call current() on a class that implements Iterator, PHP will return the first field of the object instead of calling the current() method of the interface.

We use this unusual behavior of PHP to return the warning below in this case.

Definition at line 45 of file LazyObjectStorage.php.