/**
  * Unserialize an object
  *
  * @param string $str
  * @return object
  */
 public function unserialize($str)
 {
     $o = unserialize($str);
     $className = $o['className'];
     $object = $this->objectContainer->getEmptyObject($className);
     foreach ($o['properties'] as $property => $value) {
         if (method_exists($object, 'set' . ucfirst($property))) {
             call_user_func(array($object, 'set' . ucfirst($property)), $value);
         }
     }
     return $object;
 }
 /**
  * Create an instance of $className without calling its constructor
  *
  * @param string $className
  * @return object
  * @api
  */
 public function getEmptyObject($className)
 {
     return $this->objectContainer->getEmptyObject($className);
 }
Example #3
0
 /**
  * @test
  */
 public function getEmptyObjectReturnsInstanceOfClassImplementingSerializable()
 {
     $object = $this->container->getEmptyObject('t3lib_object_tests_serializable');
     $this->assertInstanceOf('t3lib_object_tests_serializable', $object);
 }
Example #4
0
 /**
  * @test
  */
 public function getEmptyObjectInitializesObjects()
 {
     $object = $this->container->getEmptyObject('t3lib_object_tests_initializable');
     $this->assertTrue($object->isInitialized());
 }
Example #5
0
 /**
  * @test
  */
 public function getEmptyObjectReturnsInstanceOfSimpleClass()
 {
     $object = $this->container->getEmptyObject('t3lib_object_tests_c');
     $this->assertInstanceOf('t3lib_object_tests_c', $object);
 }