/** * {@inheritDoc} */ public function mapFromDb($param) { $fqcn = $this->extractFqcn($param); $reflector = new InjectionClass($fqcn); $obj = $reflector->newInstanceWithoutConstructor(); foreach ($param as $key => $val) { // go deeper $mapped = $this->mediator->recursivCreate($val); // set the value $reflector->injectProperty($obj, $key, $mapped); } // wakeup the object if ($obj instanceof Cleanable) { $obj->wakeup(); } return $obj; }
/** * @expectedException ReflectionException */ public function testErrorWhenNoWakeup() { $refl = new InjectionClass('DateTime'); $obj = $refl->newInstanceWithoutConstructor(); }