2 namespace TYPO3\CMS\Extbase\Persistence;
33 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.';
89 reset($this->storage);
99 return current($this->storage) !==
false;
111 return key($this->storage);
121 $item =
current($this->storage);
132 next($this->storage);
142 return count($this->storage);
154 $this->isModified =
true;
155 $this->storage[spl_object_hash($object)] = array(
'obj' => $object,
'inf' => $information);
157 $this->positionCounter++;
169 return is_object($object) && isset($this->storage[spl_object_hash($object)]);
180 $this->isModified =
true;
181 unset($this->storage[spl_object_hash($object)]);
183 if (empty($this->storage)) {
184 $this->positionCounter = 0;
187 $this->removedObjectsPositions[spl_object_hash($object)] = $this->addedObjectsPositions[spl_object_hash($object)];
188 unset($this->addedObjectsPositions[spl_object_hash($object)]);
199 return $this->storage[spl_object_hash($object)][
'inf'];
220 public function attach($object, $information = null)
243 $item =
current($this->storage);
255 $this->isModified =
true;
256 $key =
key($this->storage);
257 $this->storage[$key][
'inf'] = $data;
268 foreach ($objectStorage as $object) {
281 foreach ($objectStorage as $object) {
294 $storage = array_values($this->storage);
296 $array[] = $item[
'obj'];
309 throw new \RuntimeException(
'An ObjectStorage instance cannot be serialized.', 1267700868);
321 throw new \RuntimeException(
'A ObjectStorage instance cannot be unserialized.', 1267700870);
331 $this->isModified =
false;
352 return (isset($this->addedObjectsPositions[spl_object_hash($object)])
353 && isset($this->removedObjectsPositions[spl_object_hash($object)])
354 && ($this->addedObjectsPositions[spl_object_hash($object)] !== $this->removedObjectsPositions[spl_object_hash($object)]));
363 if (!isset($this->addedObjectsPositions[spl_object_hash($object)])) {
367 return $this->addedObjectsPositions[spl_object_hash($object)];