當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。