Esempio n. 1
0
 public function hydrate(array $data, $object)
 {
     if (!$object instanceof FormEntity) {
         throw new \InvalidArgumentException('Form Entity could not be mapped.');
     }
     return parent::hydrate($data, $object);
 }
Esempio n. 2
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $appConfig = $serviceLocator->get('Config');
     $moduleOptions = new ModuleOptions();
     if (isset($appConfig['smarty']) && is_array($appConfig['smarty'])) {
         $hyd = new Reflection();
         $hyd->hydrate($appConfig['smarty'], $moduleOptions);
     }
     return $moduleOptions;
 }
 /**
  * Hydrate $object with the provided $data.
  *
  * @param array $data
  * @param Entity\ModuleInterface $object
  * @return Entity\ModuleInterface
  * @throws Exception\InvalidArgumentException
  */
 public function hydrate(array $data, $object)
 {
     if (!$object instanceof Entity\ModuleInterface) {
         throw new Exception\InvalidArgumentException('$object must be an instance of ZfModule\\Entity\\ModuleEntityInterface');
     }
     $this->changeKey('module_id', 'id', $data);
     $this->changeKey('created_at', 'createdAt', $data);
     $this->changeKey('updated_at', 'updatedAt', $data);
     $this->changeKey('photo_url', 'photoUrl', $data);
     return parent::hydrate($data, $object);
 }
Esempio n. 4
0
 public function hydrate(array $data, $object)
 {
     if (!$object instanceof DetailEntity) {
         throw new \InvalidArgumentException('Detail Entity could not be mapped.');
     }
     $detail = array();
     foreach ($data as $attribute) {
         $detail[$attribute['attributename']] = $attribute['value'];
     }
     return parent::hydrate($detail, $object);
 }
Esempio n. 5
0
 public function testHydratorReflection()
 {
     $hydrator = new Reflection();
     $datas = $hydrator->extract($this->reflection);
     $this->assertTrue(isset($datas['foo']));
     $this->assertEquals($datas['foo'], '1');
     $this->assertTrue(isset($datas['fooBar']));
     $this->assertEquals($datas['fooBar'], '2');
     $this->assertTrue(isset($datas['fooBarBaz']));
     $this->assertEquals($datas['fooBarBaz'], '3');
     $test = $hydrator->hydrate(array('foo' => 'foo', 'fooBar' => 'bar', 'fooBarBaz' => 'baz'), $this->reflection);
     $this->assertEquals($test->foo, 'foo');
     $this->assertEquals($test->getFooBar(), 'bar');
     $this->assertEquals($test->getFooBarBaz(), 'baz');
 }
Esempio n. 6
0
 public function testCanHydrate()
 {
     $object = new stdClass();
     $this->assertSame($object, $this->hydrator->hydrate(array('foo' => 'bar'), $object));
 }
 /**
  * {@inheritDoc}
  */
 public function hydrate(array $data, $object)
 {
     $data = $this->hydrateViaPlugins($data, $object);
     return parent::hydrate($data, $object);
 }