TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Persistence\ObjectStorage Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Persistence\ObjectStorage:
TYPO3\CMS\Extbase\Persistence\ObjectMonitoringInterface Tx_Extbase_Persistence_ObjectStorage TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage Tx_Extbase_Persistence_LazyObjectStorage

Public Member Functions

 rewind ()
 
 valid ()
 
 key ()
 
 current ()
 
 next ()
 
 count ()
 
 offsetSet ($object, $information)
 
 offsetExists ($object)
 
 offsetUnset ($object)
 
 offsetGet ($object)
 
 contains ($object)
 
 attach ($object, $information=NULL)
 
 detach ($object)
 
 getInfo ()
 
 setInfo ($data)
 
 addAll (ObjectStorage $objectStorage)
 
 removeAll (ObjectStorage $objectStorage)
 
 toArray ()
 
 serialize ()
 
 unserialize ($serialized)
 
 _memorizeCleanState ()
 
 _isDirty ()
 
 isRelationDirty ($object)
 
 getPosition ($object)
 

Protected Attributes

 $storage = array()
 
 $isModified = FALSE
 
 $addedObjectsPositions = array()
 
 $removedObjectsPositions = array()
 
 $positionCounter = 0
 

Private Attributes

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

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! The storage for objects. It ensures the uniqueness of an object in the storage. It's a remake of the SplObjectStorage introduced in PHP 5.3.

Opposed to the SplObjectStorage the ObjectStorage does not implement the Serializable interface.

Definition at line 22 of file ObjectStorage.php.

Member Function Documentation

◆ _isDirty()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::_isDirty ( )

Returns TRUE if the storage was modified after reconstitution.

Returns
boolean

Implements TYPO3\CMS\Extbase\Persistence\ObjectMonitoringInterface.

Definition at line 317 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\$isModified.

◆ _memorizeCleanState()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::_memorizeCleanState ( )

Register the storage's clean state, e.g. after it has been reconstituted from the database.

Returns
void

Implements TYPO3\CMS\Extbase\Persistence\ObjectMonitoringInterface.

Definition at line 308 of file ObjectStorage.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage\initialize().

◆ addAll()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::addAll ( ObjectStorage  $objectStorage)

Adds all objects-data pairs from a different storage in the current storage.

Parameters
ObjectStorage$objectStorage
Returns
void

Definition at line 250 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\attach(), and TYPO3\CMS\Extbase\Persistence\ObjectStorage\getInfo().

◆ attach()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::attach (   $object,
  $information = NULL 
)

Adds an object in the storage, and optionaly associate it to some data.

Parameters
object$objectThe object to add.
mixed$informationThe data to associate with the object.
Returns
void

Definition at line 208 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\offsetSet().

Referenced by TYPO3\CMS\Extbase\Persistence\ObjectStorage\addAll().

◆ contains()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::contains (   $object)

Checks if the storage contains a specific object.

Parameters
object$objectThe object to look for.
Returns
boolean

Definition at line 197 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\offsetExists().

◆ count()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::count ( )

Returns the number of objects in the storage.

Returns
integer The number of objects in the storage.

Definition at line 134 of file ObjectStorage.php.

◆ current()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::current ( )

Returns the current storage entry.

Returns
object The object at the current iterator position.

Definition at line 115 of file ObjectStorage.php.

Referenced by TYPO3\CMS\Extbase\Persistence\ObjectStorage\getInfo(), and TYPO3\CMS\Extbase\Persistence\ObjectStorage\valid().

◆ detach()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::detach (   $object)

Removes an object from the storage.

Parameters
object$objectThe object to remove.
Returns
void

Definition at line 218 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\offsetUnset().

Referenced by TYPO3\CMS\Extbase\Persistence\ObjectStorage\removeAll().

◆ getInfo()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::getInfo ( )

Returns the data, or info, associated with the object pointed by the current iterator position.

Returns
mixed The data associated with the current iterator position.

Definition at line 227 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\current().

Referenced by TYPO3\CMS\Extbase\Persistence\ObjectStorage\addAll().

◆ getPosition()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::getPosition (   $object)
Parameters
mixed$object
Returns
integer|NULL

Definition at line 337 of file ObjectStorage.php.

◆ isRelationDirty()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::isRelationDirty (   $object)

Returns TRUE if an object is added, then removed and added at a different position

Parameters
mixed$object
Returns
boolean

Definition at line 327 of file ObjectStorage.php.

◆ key()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::key ( )

Returns the index at which the iterator currently is.

This is different from the SplObjectStorage as the key in this implementation is the object hash (string).

Returns
string The index corresponding to the position of the iterator.

Definition at line 106 of file ObjectStorage.php.

Referenced by TYPO3\CMS\Extbase\Persistence\ObjectStorage\setInfo().

◆ next()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::next ( )

Moves to the next entry.

Returns
void

Definition at line 125 of file ObjectStorage.php.

◆ offsetExists()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::offsetExists (   $object)

Checks whether an object exists in the storage.

Parameters
object$objectThe object to look for.
Returns
boolean

Definition at line 159 of file ObjectStorage.php.

Referenced by TYPO3\CMS\Extbase\Persistence\ObjectStorage\contains().

◆ offsetGet()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::offsetGet (   $object)

Returns the data associated with an object.

Parameters
object$objectThe object to look for.
Returns
mixed The data associated with an object in the storage.

Definition at line 187 of file ObjectStorage.php.

◆ offsetSet()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::offsetSet (   $object,
  $information 
)

Associates data to an object in the storage. offsetSet() is an alias of attach().

Parameters
object$objectThe object to add.
mixed$informationThe data to associate with the object.
Returns
void

Definition at line 145 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\$positionCounter.

Referenced by TYPO3\CMS\Extbase\Persistence\ObjectStorage\attach().

◆ offsetUnset()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::offsetUnset (   $object)

Removes an object from the storage. offsetUnset() is an alias of detach().

Parameters
object$objectThe object to remove.
Returns
void

Definition at line 169 of file ObjectStorage.php.

Referenced by TYPO3\CMS\Extbase\Persistence\ObjectStorage\detach().

◆ removeAll()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::removeAll ( ObjectStorage  $objectStorage)

Removes objects contained in another storage from the current storage.

Parameters
ObjectStorage$objectStorageThe storage containing the elements to remove.
Returns
void

Definition at line 262 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\detach().

◆ rewind()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::rewind ( )

Rewinds the iterator to the first storage element.

Returns
void

Definition at line 86 of file ObjectStorage.php.

◆ serialize()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::serialize ( )

Dummy method to avoid serialization.

Exceptions

Definition at line 288 of file ObjectStorage.php.

◆ setInfo()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::setInfo (   $data)

Associates data, or info, with the object currently pointed to by the iterator.

Parameters
mixed$data
Returns
void

Definition at line 238 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\key().

◆ toArray()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::toArray ( )

Returns this object storage as an array

Returns
array The object storage

Definition at line 273 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\$storage.

◆ unserialize()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::unserialize (   $serialized)

Dummy method to avoid unserialization.

Parameters
string$serialized
Exceptions

Definition at line 299 of file ObjectStorage.php.

◆ valid()

TYPO3\CMS\Extbase\Persistence\ObjectStorage::valid ( )

Checks if the array pointer of the storage points to a valid position.

Returns
boolean

Definition at line 95 of file ObjectStorage.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\current().

Member Data Documentation

◆ $addedObjectsPositions

TYPO3\CMS\Extbase\Persistence\ObjectStorage::$addedObjectsPositions = array()
protected

Definition at line 63 of file ObjectStorage.php.

◆ $isModified

TYPO3\CMS\Extbase\Persistence\ObjectStorage::$isModified = FALSE
protected

◆ $positionCounter

TYPO3\CMS\Extbase\Persistence\ObjectStorage::$positionCounter = 0
protected

◆ $removedObjectsPositions

TYPO3\CMS\Extbase\Persistence\ObjectStorage::$removedObjectsPositions = array()
protected

Definition at line 71 of file ObjectStorage.php.

◆ $storage

◆ $warning

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

Definition at line 32 of file ObjectStorage.php.