public function fromArray($values) { $hydrator = new Hydrator\ClassMethods(); $hydrator->setUnderscoreSeparatedKeys(false); $res = $hydrator->hydrate($values, $this); return $res; }
public function __construct() { $hydrator = new ClassMethods(); $hydrator->setUnderscoreSeparatedKeys(false); foreach (array('getHydrator') as $method) { $hydrator->addFilter($method, new Filter\MethodMatchFilter($method), Filter\FilterComposite::CONDITION_AND); } $this->setHydrator($hydrator); }
public function getHydrator() { if (!$this->hydrator) { $hydrator = new ClassMethods(); $hydrator->setUnderscoreSeparatedKeys(false); $hydrator->addFilter('getHydrator', new Filter\MethodMatchFilter('getHydrator'), Filter\FilterComposite::CONDITION_AND); $this->hydrator = $hydrator; } return $this->hydrator; }
public function __construct(ResourceNS\Status $status) { $this->setStatus($status); $hydrator = new ClassMethods(); $hydrator->setUnderscoreSeparatedKeys(false); foreach (array('getHydrator', 'isSuccessful') as $method) { $hydrator->addFilter($method, new Filter\MethodMatchFilter($method), Filter\FilterComposite::CONDITION_AND); } $this->setHydrator($hydrator); }
private function hydrateToArray($data) { $hydrator = new ClassMethods(false); $hydrator->setUnderscoreSeparatedKeys('_'); //$obiekt = $hydrator->hydrate($tablica, $user);// $array = $hydrator->extract($data); if ($array['id'] == null) { unset($array['id']); } return $array; }
public function __construct(Credentials\CredentialsInterface $credentials) { $this->setCredentials($credentials); $hydrator = new ClassMethods(); $hydrator->setUnderscoreSeparatedKeys(false); foreach (array('getRequestPath', 'getRequestParams', 'getResponseType', 'getBasePath', 'getPath', 'getFormat', 'getCredentials', 'getHydrator') as $method) { $hydrator->addFilter($method, new Filter\MethodMatchFilter($method), Filter\FilterComposite::CONDITION_AND); } $this->setHydrator($hydrator); $this->setFormat(ResponseInterface::FORMAT_XML); }
/** * Hydrates a Database Object using provided data * * @param $data * @param DatabaseObjectInterface $object * @return DatabaseObjectInterface */ protected function hydrateObject($data, DatabaseObjectInterface $object) { $classMethodHydrator = new ClassMethods(); $classMethodHydrator->setUnderscoreSeparatedKeys(true); $object = $classMethodHydrator->hydrate($data, $object); return $object; }
public function testHydratorClassMethodsOptions() { $hydrator = new ClassMethods(); $this->assertTrue($hydrator->getUnderscoreSeparatedKeys()); $hydrator->setOptions(array('underscoreSeparatedKeys' => false)); $this->assertFalse($hydrator->getUnderscoreSeparatedKeys()); $hydrator->setUnderscoreSeparatedKeys(true); $this->assertTrue($hydrator->getUnderscoreSeparatedKeys()); }
public function toArray() { $hydrator = new Hydrator\ClassMethods(); $hydrator->setUnderscoreSeparatedKeys(false); return $hydrator->extract($this); }
/** * Change object to array * @param type $object * @return type */ private function hydrateToArray($object) { $hydrator = new ClassMethods(false); $hydrator->setUnderscoreSeparatedKeys('_'); $array = $hydrator->extract($object); if ($array['id'] == null) { unset($array['id']); } return $array; }