当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassMethods::hydrate方法代码示例

本文整理汇总了PHP中Zend\Stdlib\Hydrator\ClassMethods::hydrate方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMethods::hydrate方法的具体用法?PHP ClassMethods::hydrate怎么用?PHP ClassMethods::hydrate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Stdlib\Hydrator\ClassMethods的用法示例。


在下文中一共展示了ClassMethods::hydrate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: persist

 public function persist(array $data, $id = null)
 {
     if (empty($data['password'])) {
         unset($data['password']);
     }
     $data['role'] = $this->em->getReference("Zf2Acl\\Entity\\Role", $data['role']);
     if ($id) {
         $entity = $this->em->getReference($this->entity, $id);
         $entity_perfil = $this->em->getReference("Zf2User\\Entity\\Perfil", $data['perfil']['id']);
         $hydrator = new Hydrator\ClassMethods();
         $hydrator->hydrate($data, $entity);
         $data['perfil']['user'] = $entity;
         $hydrator->hydrate($data['perfil'], $entity_perfil);
     } else {
         $entity = new $this->entity($data);
         $data['perfil']['user'] = $entity;
         $entity_perfil = new \Zf2User\Entity\Perfil($data['perfil']);
     }
     $this->em->persist($entity);
     $this->em->persist($entity_perfil);
     $this->em->flush();
     if ($entity->getStatus() == 0) {
         // $dataEmail = array('email' => $entity->getEmail(), 'activationKey' => $entity->getActivationKey());
         // $mail = new Mail($this->transport, $this->view, 'add-user');
         // $mail->setSubject('Confirmação de cadastro')
         //      ->setTo($entity->getEmail())
         //      ->setData($dataEmail)
         //      ->prepare()
         //      ->send();
     }
     return $entity;
 }
开发者ID:jhonmike,项目名称:zf-user,代码行数:32,代码来源:User.php

示例2: setFeed

 public function setFeed($feed)
 {
     $hydrator = new ClassMethods();
     foreach ($feed as $entry) {
         if (array_key_exists('status', $entry)) {
             $this->feed[] = $hydrator->hydrate($entry, new Status());
         } else {
             if (array_key_exists('filename', $entry)) {
                 $this->feed[] = $hydrator->hydrate($entry, new Image());
             }
         }
     }
 }
开发者ID:CPDeutschland,项目名称:zf2-api-client,代码行数:13,代码来源:User.php

示例3: hydrate

 public function hydrate(array $data, $object)
 {
     if (!$object instanceof ActivityInterface) {
         throw new Exception\InvalidArgumentException('$object must be an instance of Cobalt\\Model\\Activity\\ActivityInterface');
     }
     return parent::hydrate($data, $object);
 }
开发者ID:srayner,项目名称:cobalt,代码行数:7,代码来源:ActivityHydrator.php

示例4: hydrate

 public function hydrate(array $data, $object)
 {
     if (!$object instanceof ProjectInterface) {
         throw new \InvalidArgumentException('$object must be an instance of Application\\Model\\Project\\ProjectInterface');
     }
     return parent::hydrate($data, $object);
 }
开发者ID:srayner,项目名称:gallium,代码行数:7,代码来源:ProjectHydrator.php

示例5: hydrate

 /**
  * Hydrate $object with the provided $data.
  *
  * @param array $data 
  * @param object $object 
  * @return object
  * @throws \Exception
  */
 public function hydrate(array $data, $object)
 {
     if (!in_array('ShoppingCart\\Entity\\ShoppingCartEntityInterface', class_implements($object))) {
         throw new \Exception('$object must implement ShoppingCart\\Entity\\ShoppingCartEntityInterface');
     }
     return parent::hydrate($data, $object);
 }
开发者ID:shitikovkirill,项目名称:zend-shop.com,代码行数:15,代码来源:ShoppingCartHydrator.php

示例6: hydrate

 public function hydrate(array $data, $object)
 {
     if (!$object instanceof SubstanceInterface) {
         throw new \InvalidArgumentException('$object must be an instance of ' . __NAMESPACE__ . '\\SubstanceInterface');
     }
     return parent::hydrate($data, $object);
 }
开发者ID:srayner,项目名称:gallium,代码行数:7,代码来源:SubstanceHydrator.php

示例7: __construct

 public function __construct($data = null)
 {
     if (null !== $data) {
         $hydrator = new \Zend\Stdlib\Hydrator\ClassMethods();
         $hydrator->hydrate($data, $this);
     }
 }
开发者ID:KGalley,项目名称:whathood,代码行数:7,代码来源:HeatMap.php

示例8: __construct

 /**
  * Constructor
  */
 public function __construct($options = array())
 {
     $hydrator = new Hydrator\ClassMethods();
     $hydrator->hydrate($options, $this);
     $this->created = new \DateTime("now");
     $this->updated = new \DateTime("now");
 }
开发者ID:jhonmike,项目名称:zf-acl,代码行数:10,代码来源:Role.php

示例9: fetch

 public function fetch()
 {
     $authenticatedIdentity = $this->getApiIdentity();
     if ($authenticatedIdentity instanceof GuestIdentity) {
         $identity = $_SERVER['REMOTE_ADDR'];
     } elseif ($authenticatedIdentity instanceof AuthenticatedIdentity) {
         $identityDetails = $authenticatedIdentity->getAuthenticationIdentity();
         if (array_key_exists('client_id', $identityDetails)) {
             $identity = $identityDetails['client_id'];
         } else {
             $identity = $_SERVER['REMOTE_ADDR'];
         }
     } else {
         throw new \InvalidArgumentException('Invalid Identity Type Provided');
     }
     if (array_key_exists($identity, $this->getConfig())) {
         $clientConfigArray = $this->getConfig()[$identity];
     }
     if (empty($clientConfigArray)) {
         $clientConfigArray = $this->getConfig()['default'];
     }
     $clientRateLimitConfig = new ClientRateLimitConfig();
     $hydrator = new ClassMethods();
     $hydrator->hydrate($clientConfigArray, $clientRateLimitConfig);
     $clientRateLimitConfig->setIdentity($identity);
     return $clientRateLimitConfig;
 }
开发者ID:nobesnickr,项目名称:ApiTimesheets,代码行数:27,代码来源:ClientRateLimitConfigService.php

示例10: setComments

 public function setComments($comments)
 {
     $hydrator = new ClassMethods();
     foreach ($comments as $c) {
         $this->comments[] = $hydrator->hydrate($c, new Comment());
     }
 }
开发者ID:navidnahidi,项目名称:zf2_client,代码行数:7,代码来源:Status.php

示例11: hydrate

 /**
  * hydrate
  *
  * @param unknown_type $object
  * @throws Exception\InvalidArgumentException
  */
 public function hydrate(array $data, $object)
 {
     if (!$object instanceof VisitInterface) {
         throw new Exception\InvalidArgumentException('$object must be an instance of Zf2Forum\\Model\\Visit\\VisitInterface');
     }
     return parent::hydrate($data, $object);
 }
开发者ID:stijnhau,项目名称:zf2-forum,代码行数:13,代码来源:VisitHydrator.php

示例12: hydrate

 /**
  * @param array $data
  * @param object $object
  * @return Error
  */
 public function hydrate(array $data, $object)
 {
     if (!isset($data['error'])) {
         return $object;
     }
     return parent::hydrate($data['error'], new Error());
 }
开发者ID:MusicalAPP,项目名称:spotify-web-api,代码行数:12,代码来源:ErrorHydrator.php

示例13: hydrate

 /**
  * Hydrate $object with the provided $data.
  *
  * @param  array $data
  * @param  object $object
  * @return CountryInterface
  * @throws Exception\InvalidArgumentException
  */
 public function hydrate(array $data, $object)
 {
     if (!$object instanceof CountryEntityInterface) {
         throw new Exception\InvalidArgumentException('$object must be an instance of DelCountriesFlags\\Entity\\CountryInterface');
     }
     return parent::hydrate($data, $object);
 }
开发者ID:delboy1978uk,项目名称:del-countries-flags,代码行数:15,代码来源:CountryHydrator.php

示例14: fromArray

 public function fromArray($values)
 {
     $hydrator = new Hydrator\ClassMethods();
     $hydrator->setUnderscoreSeparatedKeys(false);
     $res = $hydrator->hydrate($values, $this);
     return $res;
 }
开发者ID:fuca,项目名称:sportsclub,代码行数:7,代码来源:EntityMapperTrait.php

示例15: __construct

 /**
  * Constructor
  */
 public function __construct(array $data)
 {
     $this->caracteristicaPerfil = new \Doctrine\Common\Collections\ArrayCollection();
     $this->produto = new \Doctrine\Common\Collections\ArrayCollection();
     $hydrator = new ClassMethods();
     $hydrator->hydrate($data, $this);
 }
开发者ID:RodrigoAngeloValentini,项目名称:curso-zf2,代码行数:10,代码来源:Caracteristica.php


注:本文中的Zend\Stdlib\Hydrator\ClassMethods::hydrate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。