本文整理汇总了PHP中Zend\Stdlib\Hydrator\ClassMethods::setUnderscoreSeparatedKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMethods::setUnderscoreSeparatedKeys方法的具体用法?PHP ClassMethods::setUnderscoreSeparatedKeys怎么用?PHP ClassMethods::setUnderscoreSeparatedKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Stdlib\Hydrator\ClassMethods
的用法示例。
在下文中一共展示了ClassMethods::setUnderscoreSeparatedKeys方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromArray
public function fromArray($values)
{
$hydrator = new Hydrator\ClassMethods();
$hydrator->setUnderscoreSeparatedKeys(false);
$res = $hydrator->hydrate($values, $this);
return $res;
}
示例2: __construct
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);
}
示例3: getHydrator
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;
}
示例4: __construct
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);
}
示例5: hydrateToArray
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;
}
示例6: __construct
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);
}
示例7: hydrateObject
/**
* 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;
}
示例8: testHydratorClassMethodsOptions
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());
}
示例9: toArray
public function toArray()
{
$hydrator = new Hydrator\ClassMethods();
$hydrator->setUnderscoreSeparatedKeys(false);
return $hydrator->extract($this);
}
示例10: hydrateToArray
/**
* 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;
}