32 private $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.';
87 reset($this->storage);
96 return current($this->storage) !== FALSE;
107 return key($this->storage);
116 $item =
current($this->storage);
126 next($this->storage);
135 return count($this->storage);
146 $this->isModified = TRUE;
147 $this->storage[spl_object_hash($object)] = array(
'obj' => $object,
'inf' => $information);
149 $this->positionCounter++;
160 return is_object($object) && isset($this->storage[spl_object_hash($object)]);
170 $this->isModified = TRUE;
171 unset($this->storage[spl_object_hash($object)]);
173 if (empty($this->storage)) {
174 $this->positionCounter = 0;
177 $this->removedObjectsPositions[spl_object_hash($object)] = $this->addedObjectsPositions[spl_object_hash($object)];
178 unset($this->addedObjectsPositions[spl_object_hash($object)]);
188 return $this->storage[spl_object_hash($object)][
'inf'];
208 public function attach($object, $information = NULL) {
228 $item =
current($this->storage);
239 $this->isModified = TRUE;
240 $key =
key($this->storage);
241 $this->storage[$key][
'inf'] = $data;
251 foreach ($objectStorage as $object) {
263 foreach ($objectStorage as $object) {
275 $storage = array_values($this->storage);
277 $array[] = $item[
'obj'];
289 throw new \RuntimeException(
'An ObjectStorage instance cannot be serialized.', 1267700868);
300 throw new \RuntimeException(
'A ObjectStorage instance cannot be unserialized.', 1267700870);
309 $this->isModified = FALSE;
328 return (isset($this->addedObjectsPositions[spl_object_hash($object)])
329 && isset($this->removedObjectsPositions[spl_object_hash($object)])
330 && ($this->addedObjectsPositions[spl_object_hash($object)] !== $this->removedObjectsPositions[spl_object_hash($object)]));
338 if (!isset($this->addedObjectsPositions[spl_object_hash($object)])) {
342 return $this->addedObjectsPositions[spl_object_hash($object)];
addAll(ObjectStorage $objectStorage)
removeAll(ObjectStorage $objectStorage)
attach($object, $information=NULL)
offsetSet($object, $information)