/** * @test */ public function getInfoReturnsTheDataAssociatedWithTheCurrentIteratorEntry() { $objectStorage = new Tx_Extbase_Persistence_ObjectStorage(); $object1 = new StdClass(); $object2 = new StdClass(); $object3 = new StdClass(); $objectStorage->attach($object1, 42); $objectStorage->attach($object2, 'foo'); $objectStorage->attach($object3, array('bar', 'baz')); $objectStorage->rewind(); $this->assertEquals($objectStorage->getInfo(), 42); $objectStorage->next(); $this->assertEquals($objectStorage->getInfo(), 'foo'); $objectStorage->next(); $this->assertEquals($objectStorage->getInfo(), array('bar', 'baz')); }
/** * Adds all objects-data pairs from a different storage in the current storage. * * @param Tx_Extbase_Persistence_ObjectStorage $storage The storage you want to import. * @return void */ public function addAll(Tx_Extbase_Persistence_ObjectStorage $storage) { foreach ($storage as $object) { $this->attach($object, $storage->getInfo()); } }