public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = $value instanceof \MongoId ? (string) $value : $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['since'])) {
         $value = $data['since'];
         if ($value === null) {
             $return = null;
         } else {
             $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value);
         }
         $this->class->reflFields['since']->setValue($document, clone $return);
         $hydratedData['since'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['users']) ? $data['users'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['users']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['users']->setValue($document, $return);
     $hydratedData['users'] = $return;
     /** @Field(type="boolean") */
     if (isset($data['verified'])) {
         $value = $data['verified'];
         $return = (bool) $value;
         $this->class->reflFields['verified']->setValue($document, $return);
         $hydratedData['verified'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['sent'])) {
         $value = $data['sent'];
         $return = (bool) $value;
         $this->class->reflFields['sent']->setValue($document, $return);
         $hydratedData['sent'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['lastContact'])) {
         $value = $data['lastContact'];
         if ($value === null) {
             $return = null;
         } else {
             $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value);
         }
         $this->class->reflFields['lastContact']->setValue($document, clone $return);
         $hydratedData['lastContact'] = $return;
     }
     return $hydratedData;
 }
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = $value instanceof \MongoId ? (string) $value : $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @ReferenceOne */
     if (isset($data['author'])) {
         $reference = $data['author'];
         if (isset($this->class->fieldMappings['author']['simple']) && $this->class->fieldMappings['author']['simple']) {
             $className = $this->class->fieldMappings['author']['targetDocument'];
             $mongoId = $reference;
         } else {
             $className = $this->unitOfWork->getClassNameForAssociation($this->class->fieldMappings['author'], $reference);
             $mongoId = $reference['$id'];
         }
         $targetMetadata = $this->dm->getClassMetadata($className);
         $id = $targetMetadata->getPHPIdentifierValue($mongoId);
         $return = $this->dm->getReference($className, $id);
         $this->class->reflFields['author']->setValue($document, $return);
         $hydratedData['author'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['date'])) {
         $value = $data['date'];
         if ($value === null) {
             $return = null;
         } else {
             $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value);
         }
         $this->class->reflFields['date']->setValue($document, clone $return);
         $hydratedData['date'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['text'])) {
         $value = $data['text'];
         $return = (string) $value;
         $this->class->reflFields['text']->setValue($document, $return);
         $hydratedData['text'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['replies']) ? $data['replies'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['replies']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['replies']->setValue($document, $return);
     $hydratedData['replies'] = $return;
     return $hydratedData;
 }
Ejemplo n.º 3
0
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="string") */
     if (isset($data['user_id'])) {
         $value = $data['user_id'];
         $return = (string) $value;
         $this->class->reflFields['user_id']->setValue($document, $return);
         $hydratedData['user_id'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['special']) ? $data['special'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['special']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['special']->setValue($document, $return);
     $hydratedData['special'] = $return;
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = (string) $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['created_at'])) {
         $value = $data['created_at'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['created_at']->setValue($document, clone $return);
         $hydratedData['created_at'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['updated_at'])) {
         $value = $data['updated_at'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['updated_at']->setValue($document, clone $return);
         $hydratedData['updated_at'] = $return;
     }
     return $hydratedData;
 }
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = $value instanceof \MongoId ? (string) $value : $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['name'])) {
         $value = $data['name'];
         $return = (string) $value;
         $this->class->reflFields['name']->setValue($document, $return);
         $hydratedData['name'] = $return;
     }
     /** @Field(type="float") */
     if (isset($data['price'])) {
         $value = $data['price'];
         $return = (double) $value;
         $this->class->reflFields['price']->setValue($document, $return);
         $hydratedData['price'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['description']) ? $data['description'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['description']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['description']->setValue($document, $return);
     $hydratedData['description'] = $return;
     return $hydratedData;
 }
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="string") */
     if (isset($data['username'])) {
         $value = $data['username'];
         $return = (string) $value;
         $this->class->reflFields['username']->setValue($document, $return);
         $hydratedData['username'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['password'])) {
         $value = $data['password'];
         $return = (string) $value;
         $this->class->reflFields['password']->setValue($document, $return);
         $hydratedData['password'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['email'])) {
         $value = $data['email'];
         $return = (string) $value;
         $this->class->reflFields['email']->setValue($document, $return);
         $hydratedData['email'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['salt'])) {
         $value = $data['salt'];
         $return = (string) $value;
         $this->class->reflFields['salt']->setValue($document, $return);
         $hydratedData['salt'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['accountNonExpired'])) {
         $value = $data['accountNonExpired'];
         $return = (bool) $value;
         $this->class->reflFields['accountNonExpired']->setValue($document, $return);
         $hydratedData['accountNonExpired'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['accountNonLocked'])) {
         $value = $data['accountNonLocked'];
         $return = (bool) $value;
         $this->class->reflFields['accountNonLocked']->setValue($document, $return);
         $hydratedData['accountNonLocked'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['credentialsNonExpired'])) {
         $value = $data['credentialsNonExpired'];
         $return = (bool) $value;
         $this->class->reflFields['credentialsNonExpired']->setValue($document, $return);
         $hydratedData['credentialsNonExpired'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['enabled'])) {
         $value = $data['enabled'];
         $return = (bool) $value;
         $this->class->reflFields['enabled']->setValue($document, $return);
         $hydratedData['enabled'] = $return;
     }
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = $value instanceof \MongoId ? (string) $value : $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['roles']) ? $data['roles'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['userRoles']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['userRoles']->setValue($document, $return);
     $hydratedData['userRoles'] = $return;
     /** @Many */
     $mongoData = isset($data['posts']) ? $data['posts'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['posts']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['posts']->setValue($document, $return);
     $hydratedData['posts'] = $return;
     return $hydratedData;
 }
Ejemplo n.º 6
0
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="string") */
     if (isset($data['openid'])) {
         $value = $data['openid'];
         $return = (string) $value;
         $this->class->reflFields['openid']->setValue($document, $return);
         $hydratedData['openid'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['subscribe'])) {
         $value = $data['subscribe'];
         $return = (int) $value;
         $this->class->reflFields['subscribe']->setValue($document, $return);
         $hydratedData['subscribe'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['nickname'])) {
         $value = $data['nickname'];
         $return = (string) $value;
         $this->class->reflFields['nickname']->setValue($document, $return);
         $hydratedData['nickname'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['sex'])) {
         $value = $data['sex'];
         $return = (int) $value;
         $this->class->reflFields['sex']->setValue($document, $return);
         $hydratedData['sex'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['language'])) {
         $value = $data['language'];
         $return = (string) $value;
         $this->class->reflFields['language']->setValue($document, $return);
         $hydratedData['language'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['city'])) {
         $value = $data['city'];
         $return = (string) $value;
         $this->class->reflFields['city']->setValue($document, $return);
         $hydratedData['city'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['province'])) {
         $value = $data['province'];
         $return = (string) $value;
         $this->class->reflFields['province']->setValue($document, $return);
         $hydratedData['province'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['country'])) {
         $value = $data['country'];
         $return = (string) $value;
         $this->class->reflFields['country']->setValue($document, $return);
         $hydratedData['country'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['headimgurl'])) {
         $value = $data['headimgurl'];
         $return = (string) $value;
         $this->class->reflFields['headimgurl']->setValue($document, $return);
         $hydratedData['headimgurl'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['subscribe_time'])) {
         $value = $data['subscribe_time'];
         $return = (string) $value;
         $this->class->reflFields['subscribe_time']->setValue($document, $return);
         $hydratedData['subscribe_time'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['last_time'])) {
         $value = $data['last_time'];
         $return = (int) $value;
         $this->class->reflFields['last_time']->setValue($document, $return);
         $hydratedData['last_time'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['access_token'])) {
         $value = $data['access_token'];
         $return = (string) $value;
         $this->class->reflFields['access_token']->setValue($document, $return);
         $hydratedData['access_token'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['usertype'])) {
         $value = $data['usertype'];
         $return = (string) $value;
         $this->class->reflFields['usertype']->setValue($document, $return);
         $hydratedData['usertype'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['name'])) {
         $value = $data['name'];
         $return = (string) $value;
         $this->class->reflFields['name']->setValue($document, $return);
         $hydratedData['name'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['head_pic'])) {
         $value = $data['head_pic'];
         $return = (string) $value;
         $this->class->reflFields['head_pic']->setValue($document, $return);
         $hydratedData['head_pic'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['birthday'])) {
         $value = $data['birthday'];
         $return = (string) $value;
         $this->class->reflFields['birthday']->setValue($document, $return);
         $hydratedData['birthday'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['place'])) {
         $value = $data['place'];
         $return = (string) $value;
         $this->class->reflFields['place']->setValue($document, $return);
         $hydratedData['place'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['educational'])) {
         $value = $data['educational'];
         $return = (string) $value;
         $this->class->reflFields['educational']->setValue($document, $return);
         $hydratedData['educational'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['certificate']) ? $data['certificate'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['certificate']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['certificate']->setValue($document, $return);
     $hydratedData['certificate'] = $return;
     /** @Field(type="string") */
     if (isset($data['phone'])) {
         $value = $data['phone'];
         $return = (string) $value;
         $this->class->reflFields['phone']->setValue($document, $return);
         $hydratedData['phone'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['code'])) {
         $value = $data['code'];
         $return = (string) $value;
         $this->class->reflFields['code']->setValue($document, $return);
         $hydratedData['code'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['email'])) {
         $value = $data['email'];
         $return = (string) $value;
         $this->class->reflFields['email']->setValue($document, $return);
         $hydratedData['email'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['qq'])) {
         $value = $data['qq'];
         $return = (string) $value;
         $this->class->reflFields['qq']->setValue($document, $return);
         $hydratedData['qq'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['years'])) {
         $value = $data['years'];
         $return = (int) $value;
         $this->class->reflFields['years']->setValue($document, $return);
         $hydratedData['years'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['wechat'])) {
         $value = $data['wechat'];
         $return = (string) $value;
         $this->class->reflFields['wechat']->setValue($document, $return);
         $hydratedData['wechat'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['location'])) {
         $value = $data['location'];
         $return = (string) $value;
         $this->class->reflFields['location']->setValue($document, $return);
         $hydratedData['location'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['region']) ? $data['region'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['region']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['region']->setValue($document, $return);
     $hydratedData['region'] = $return;
     /** @Many */
     $mongoData = isset($data['category']) ? $data['category'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['category']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['category']->setValue($document, $return);
     $hydratedData['category'] = $return;
     /** @Many */
     $mongoData = isset($data['lesson']) ? $data['lesson'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['lesson']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['lesson']->setValue($document, $return);
     $hydratedData['lesson'] = $return;
     /** @Field(type="string") */
     if (isset($data['bank'])) {
         $value = $data['bank'];
         $return = (string) $value;
         $this->class->reflFields['bank']->setValue($document, $return);
         $hydratedData['bank'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['bank_code'])) {
         $value = $data['bank_code'];
         $return = (string) $value;
         $this->class->reflFields['bank_code']->setValue($document, $return);
         $hydratedData['bank_code'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['description'])) {
         $value = $data['description'];
         $return = (string) $value;
         $this->class->reflFields['description']->setValue($document, $return);
         $hydratedData['description'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['experience'])) {
         $value = $data['experience'];
         $return = (string) $value;
         $this->class->reflFields['experience']->setValue($document, $return);
         $hydratedData['experience'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['price'])) {
         $value = $data['price'];
         $return = (string) $value;
         $this->class->reflFields['price']->setValue($document, $return);
         $hydratedData['price'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['teacher_count'])) {
         $value = $data['teacher_count'];
         $return = (int) $value;
         $this->class->reflFields['teacher_count']->setValue($document, $return);
         $hydratedData['teacher_count'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['amount'])) {
         $value = $data['amount'];
         $return = (string) $value;
         $this->class->reflFields['amount']->setValue($document, $return);
         $hydratedData['amount'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['use_amount'])) {
         $value = $data['use_amount'];
         $return = (string) $value;
         $this->class->reflFields['use_amount']->setValue($document, $return);
         $hydratedData['use_amount'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['coupon']) ? $data['coupon'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['coupon']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['coupon']->setValue($document, $return);
     $hydratedData['coupon'] = $return;
     /** @Many */
     $mongoData = isset($data['skill']) ? $data['skill'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['skill']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['skill']->setValue($document, $return);
     $hydratedData['skill'] = $return;
     /** @Field(type="int") */
     if (isset($data['frozen'])) {
         $value = $data['frozen'];
         $return = (int) $value;
         $this->class->reflFields['frozen']->setValue($document, $return);
         $hydratedData['frozen'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['delete'])) {
         $value = $data['delete'];
         $return = (int) $value;
         $this->class->reflFields['delete']->setValue($document, $return);
         $hydratedData['delete'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['photo']) ? $data['photo'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['photo']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['photo']->setValue($document, $return);
     $hydratedData['photo'] = $return;
     /** @Field(type="string") */
     if (isset($data['user_score'])) {
         $value = $data['user_score'];
         $return = (string) $value;
         $this->class->reflFields['user_score']->setValue($document, $return);
         $hydratedData['user_score'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['teacher_score'])) {
         $value = $data['teacher_score'];
         $return = (string) $value;
         $this->class->reflFields['teacher_score']->setValue($document, $return);
         $hydratedData['teacher_score'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['is_reg'])) {
         $value = $data['is_reg'];
         $return = (int) $value;
         $this->class->reflFields['is_reg']->setValue($document, $return);
         $hydratedData['is_reg'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['serial_number'])) {
         $value = $data['serial_number'];
         $return = (string) $value;
         $this->class->reflFields['serial_number']->setValue($document, $return);
         $hydratedData['serial_number'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['cell'])) {
         $value = $data['cell'];
         $return = (string) $value;
         $this->class->reflFields['cell']->setValue($document, $return);
         $hydratedData['cell'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['range'])) {
         $value = $data['range'];
         $return = (int) $value;
         $this->class->reflFields['range']->setValue($document, $return);
         $hydratedData['range'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['lng'])) {
         $value = $data['lng'];
         $return = (string) $value;
         $this->class->reflFields['lng']->setValue($document, $return);
         $hydratedData['lng'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['lat'])) {
         $value = $data['lat'];
         $return = (string) $value;
         $this->class->reflFields['lat']->setValue($document, $return);
         $hydratedData['lat'] = $return;
     }
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = (string) $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['created_at'])) {
         $value = $data['created_at'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['created_at']->setValue($document, clone $return);
         $hydratedData['created_at'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['updated_at'])) {
         $value = $data['updated_at'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['updated_at']->setValue($document, clone $return);
         $hydratedData['updated_at'] = $return;
     }
     return $hydratedData;
 }
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = $value instanceof \MongoId ? (string) $value : $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['userName'])) {
         $value = $data['userName'];
         $return = (string) $value;
         $this->class->reflFields['userName']->setValue($document, $return);
         $hydratedData['userName'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['email'])) {
         $value = $data['email'];
         $return = (string) $value;
         $this->class->reflFields['email']->setValue($document, $return);
         $hydratedData['email'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['password'])) {
         $value = $data['password'];
         $return = (string) $value;
         $this->class->reflFields['password']->setValue($document, $return);
         $hydratedData['password'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['firstName'])) {
         $value = $data['firstName'];
         $return = (string) $value;
         $this->class->reflFields['firstName']->setValue($document, $return);
         $hydratedData['firstName'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['lastName'])) {
         $value = $data['lastName'];
         $return = (string) $value;
         $this->class->reflFields['lastName']->setValue($document, $return);
         $hydratedData['lastName'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['status'])) {
         $value = $data['status'];
         $return = (string) $value;
         $this->class->reflFields['status']->setValue($document, $return);
         $hydratedData['status'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['created'])) {
         $value = $data['created'];
         if ($value === null) {
             $return = null;
         } else {
             $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value);
         }
         $this->class->reflFields['created']->setValue($document, clone $return);
         $hydratedData['created'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['lastLogin'])) {
         $value = $data['lastLogin'];
         if ($value === null) {
             $return = null;
         } else {
             $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value);
         }
         $this->class->reflFields['lastLogin']->setValue($document, clone $return);
         $hydratedData['lastLogin'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['lastLogout'])) {
         $value = $data['lastLogout'];
         if ($value === null) {
             $return = null;
         } else {
             $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value);
         }
         $this->class->reflFields['lastLogout']->setValue($document, clone $return);
         $hydratedData['lastLogout'] = $return;
     }
     /** @EmbedOne */
     if (isset($data['profile'])) {
         $embeddedDocument = $data['profile'];
         $className = $this->unitOfWork->getClassNameForAssociation($this->class->fieldMappings['profile'], $embeddedDocument);
         $embeddedMetadata = $this->dm->getClassMetadata($className);
         $return = $embeddedMetadata->newInstance();
         $embeddedData = $this->dm->getHydratorFactory()->hydrate($return, $embeddedDocument, $hints);
         $embeddedId = $embeddedMetadata->identifier && isset($embeddedData[$embeddedMetadata->identifier]) ? $embeddedData[$embeddedMetadata->identifier] : null;
         $this->unitOfWork->registerManaged($return, $embeddedId, $embeddedData);
         $this->unitOfWork->setParentAssociation($return, $this->class->fieldMappings['profile'], $document, 'profile');
         $this->class->reflFields['profile']->setValue($document, $return);
         $hydratedData['profile'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['messages']) ? $data['messages'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['messages']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['messages']->setValue($document, $return);
     $hydratedData['messages'] = $return;
     /** @Many */
     $mongoData = isset($data['connectedToMe']) ? $data['connectedToMe'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['connectedToMe']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['connectedToMe']->setValue($document, $return);
     $hydratedData['connectedToMe'] = $return;
     /** @Many */
     $mongoData = isset($data['myConnections']) ? $data['myConnections'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['myConnections']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['myConnections']->setValue($document, $return);
     $hydratedData['myConnections'] = $return;
     /** @Many */
     $mongoData = isset($data['posts']) ? $data['posts'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['posts']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['posts']->setValue($document, $return);
     $hydratedData['posts'] = $return;
     /** @Many */
     $mongoData = isset($data['skills']) ? $data['skills'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['skills']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['skills']->setValue($document, $return);
     $hydratedData['skills'] = $return;
     return $hydratedData;
 }
Ejemplo n.º 8
0
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="string") */
     if (isset($data['name'])) {
         $value = $data['name'];
         $return = (string) $value;
         $this->class->reflFields['name']->setValue($document, $return);
         $hydratedData['name'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['sub_title'])) {
         $value = $data['sub_title'];
         $return = (string) $value;
         $this->class->reflFields['sub_title']->setValue($document, $return);
         $hydratedData['sub_title'] = $return;
     }
     /** @ReferenceOne */
     if (isset($data['oss_video'])) {
         $reference = $data['oss_video'];
         if (isset($this->class->fieldMappings['oss_video']['simple']) && $this->class->fieldMappings['oss_video']['simple']) {
             $className = $this->class->fieldMappings['oss_video']['targetDocument'];
             $mongoId = $reference;
         } else {
             $className = $this->dm->getClassNameFromDiscriminatorValue($this->class->fieldMappings['oss_video'], $reference);
             $mongoId = $reference['$id'];
         }
         $targetMetadata = $this->dm->getClassMetadata($className);
         $id = $targetMetadata->getPHPIdentifierValue($mongoId);
         $return = $this->dm->getReference($className, $id);
         $this->class->reflFields['oss_video']->setValue($document, $return);
         $hydratedData['oss_video'] = $return;
     }
     /** @ReferenceOne */
     if (isset($data['oss_audio'])) {
         $reference = $data['oss_audio'];
         if (isset($this->class->fieldMappings['oss_audio']['simple']) && $this->class->fieldMappings['oss_audio']['simple']) {
             $className = $this->class->fieldMappings['oss_audio']['targetDocument'];
             $mongoId = $reference;
         } else {
             $className = $this->dm->getClassNameFromDiscriminatorValue($this->class->fieldMappings['oss_audio'], $reference);
             $mongoId = $reference['$id'];
         }
         $targetMetadata = $this->dm->getClassMetadata($className);
         $id = $targetMetadata->getPHPIdentifierValue($mongoId);
         $return = $this->dm->getReference($className, $id);
         $this->class->reflFields['oss_audio']->setValue($document, $return);
         $hydratedData['oss_audio'] = $return;
     }
     /** @ReferenceOne */
     if (isset($data['author'])) {
         $reference = $data['author'];
         if (isset($this->class->fieldMappings['author']['simple']) && $this->class->fieldMappings['author']['simple']) {
             $className = $this->class->fieldMappings['author']['targetDocument'];
             $mongoId = $reference;
         } else {
             $className = $this->dm->getClassNameFromDiscriminatorValue($this->class->fieldMappings['author'], $reference);
             $mongoId = $reference['$id'];
         }
         $targetMetadata = $this->dm->getClassMetadata($className);
         $id = $targetMetadata->getPHPIdentifierValue($mongoId);
         $return = $this->dm->getReference($className, $id);
         $this->class->reflFields['author']->setValue($document, $return);
         $hydratedData['author'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['duration'])) {
         $value = $data['duration'];
         $return = (int) $value;
         $this->class->reflFields['duration']->setValue($document, $return);
         $hydratedData['duration'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['time'])) {
         $value = $data['time'];
         $return = (string) $value;
         $this->class->reflFields['time']->setValue($document, $return);
         $hydratedData['time'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['keyword']) ? $data['keyword'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['keyword']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['keyword']->setValue($document, $return);
     $hydratedData['keyword'] = $return;
     /** @Field(type="string") */
     if (isset($data['description'])) {
         $value = $data['description'];
         $return = (string) $value;
         $this->class->reflFields['description']->setValue($document, $return);
         $hydratedData['description'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['photo']) ? $data['photo'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['photo']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['photo']->setValue($document, $return);
     $hydratedData['photo'] = $return;
     /** @Field(type="string") */
     if (isset($data['status'])) {
         $value = $data['status'];
         $return = (string) $value;
         $this->class->reflFields['status']->setValue($document, $return);
         $hydratedData['status'] = $return;
     }
     /** @ReferenceOne */
     if (isset($data['owner'])) {
         $reference = $data['owner'];
         if (isset($this->class->fieldMappings['owner']['simple']) && $this->class->fieldMappings['owner']['simple']) {
             $className = $this->class->fieldMappings['owner']['targetDocument'];
             $mongoId = $reference;
         } else {
             $className = $this->dm->getClassNameFromDiscriminatorValue($this->class->fieldMappings['owner'], $reference);
             $mongoId = $reference['$id'];
         }
         $targetMetadata = $this->dm->getClassMetadata($className);
         $id = $targetMetadata->getPHPIdentifierValue($mongoId);
         $return = $this->dm->getReference($className, $id);
         $this->class->reflFields['owner']->setValue($document, $return);
         $hydratedData['owner'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['captions'])) {
         $value = $data['captions'];
         $return = (string) $value;
         $this->class->reflFields['captions']->setValue($document, $return);
         $hydratedData['captions'] = $return;
     }
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = (string) $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['created_at'])) {
         $value = $data['created_at'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['created_at']->setValue($document, clone $return);
         $hydratedData['created_at'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['updated_at'])) {
         $value = $data['updated_at'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['updated_at']->setValue($document, clone $return);
         $hydratedData['updated_at'] = $return;
     }
     return $hydratedData;
 }
Ejemplo n.º 9
0
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="string") */
     if (isset($data['email'])) {
         $value = $data['email'];
         $return = (string) $value;
         $this->class->reflFields['email']->setValue($document, $return);
         $hydratedData['email'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['user_type'])) {
         $value = $data['user_type'];
         $return = (string) $value;
         $this->class->reflFields['user_type']->setValue($document, $return);
         $hydratedData['user_type'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['username'])) {
         $value = $data['username'];
         $return = (string) $value;
         $this->class->reflFields['username']->setValue($document, $return);
         $hydratedData['username'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['name'])) {
         $value = $data['name'];
         $return = (string) $value;
         $this->class->reflFields['name']->setValue($document, $return);
         $hydratedData['name'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['author'])) {
         $value = $data['author'];
         $return = (int) $value;
         $this->class->reflFields['author']->setValue($document, $return);
         $hydratedData['author'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['identity_type'])) {
         $value = $data['identity_type'];
         $return = (string) $value;
         $this->class->reflFields['identity_type']->setValue($document, $return);
         $hydratedData['identity_type'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['identity_id'])) {
         $value = $data['identity_id'];
         $return = (string) $value;
         $this->class->reflFields['identity_id']->setValue($document, $return);
         $hydratedData['identity_id'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['password'])) {
         $value = $data['password'];
         $return = (string) $value;
         $this->class->reflFields['password']->setValue($document, $return);
         $hydratedData['password'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['password_src'])) {
         $value = $data['password_src'];
         $return = (string) $value;
         $this->class->reflFields['password_src']->setValue($document, $return);
         $hydratedData['password_src'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['age'])) {
         $value = $data['age'];
         $return = (int) $value;
         $this->class->reflFields['age']->setValue($document, $return);
         $hydratedData['age'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['gender'])) {
         $value = $data['gender'];
         $return = (string) $value;
         $this->class->reflFields['gender']->setValue($document, $return);
         $hydratedData['gender'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['salt'])) {
         $value = $data['salt'];
         $return = (string) $value;
         $this->class->reflFields['salt']->setValue($document, $return);
         $hydratedData['salt'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['active_bln'])) {
         $value = $data['active_bln'];
         $return = (bool) $value;
         $this->class->reflFields['active_bln']->setValue($document, $return);
         $hydratedData['active_bln'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['email_validated_bln'])) {
         $value = $data['email_validated_bln'];
         $return = (bool) $value;
         $this->class->reflFields['email_validated_bln']->setValue($document, $return);
         $hydratedData['email_validated_bln'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['validated_bln'])) {
         $value = $data['validated_bln'];
         $return = (bool) $value;
         $this->class->reflFields['validated_bln']->setValue($document, $return);
         $hydratedData['validated_bln'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['admin_bln'])) {
         $value = $data['admin_bln'];
         $return = (bool) $value;
         $this->class->reflFields['admin_bln']->setValue($document, $return);
         $hydratedData['admin_bln'] = $return;
     }
     /** @Field(type="boolean") */
     if (isset($data['wait_tobe_validate'])) {
         $value = $data['wait_tobe_validate'];
         $return = (bool) $value;
         $this->class->reflFields['wait_tobe_validate']->setValue($document, $return);
         $hydratedData['wait_tobe_validate'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['profile_image'])) {
         $value = $data['profile_image'];
         $return = (string) $value;
         $this->class->reflFields['profile_image']->setValue($document, $return);
         $hydratedData['profile_image'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['phone'])) {
         $value = $data['phone'];
         $return = (string) $value;
         $this->class->reflFields['phone']->setValue($document, $return);
         $hydratedData['phone'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['address'])) {
         $value = $data['address'];
         $return = (string) $value;
         $this->class->reflFields['address']->setValue($document, $return);
         $hydratedData['address'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['ip'])) {
         $value = $data['ip'];
         $return = (string) $value;
         $this->class->reflFields['ip']->setValue($document, $return);
         $hydratedData['ip'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['last_login'])) {
         $value = $data['last_login'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['last_login']->setValue($document, clone $return);
         $hydratedData['last_login'] = $return;
     }
     /** @EmbedOne */
     if (isset($data['identity_front_doc'])) {
         $embeddedDocument = $data['identity_front_doc'];
         $className = $this->dm->getClassNameFromDiscriminatorValue($this->class->fieldMappings['identity_front_doc'], $embeddedDocument);
         $embeddedMetadata = $this->dm->getClassMetadata($className);
         $return = $embeddedMetadata->newInstance();
         $embeddedData = $this->dm->getHydratorFactory()->hydrate($return, $embeddedDocument, $hints);
         $this->unitOfWork->registerManaged($return, null, $embeddedData);
         $this->unitOfWork->setParentAssociation($return, $this->class->fieldMappings['identity_front_doc'], $document, 'identity_front_doc');
         $this->class->reflFields['identity_front_doc']->setValue($document, $return);
         $hydratedData['identity_front_doc'] = $return;
     }
     /** @EmbedOne */
     if (isset($data['identity_back_doc'])) {
         $embeddedDocument = $data['identity_back_doc'];
         $className = $this->dm->getClassNameFromDiscriminatorValue($this->class->fieldMappings['identity_back_doc'], $embeddedDocument);
         $embeddedMetadata = $this->dm->getClassMetadata($className);
         $return = $embeddedMetadata->newInstance();
         $embeddedData = $this->dm->getHydratorFactory()->hydrate($return, $embeddedDocument, $hints);
         $this->unitOfWork->registerManaged($return, null, $embeddedData);
         $this->unitOfWork->setParentAssociation($return, $this->class->fieldMappings['identity_back_doc'], $document, 'identity_back_doc');
         $this->class->reflFields['identity_back_doc']->setValue($document, $return);
         $hydratedData['identity_back_doc'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['identity_refused_reason']) ? $data['identity_refused_reason'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['identity_refused_reason']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['identity_refused_reason']->setValue($document, $return);
     $hydratedData['identity_refused_reason'] = $return;
     /** @Many */
     $mongoData = isset($data['invested_companies']) ? $data['invested_companies'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['invested_companies']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['invested_companies']->setValue($document, $return);
     $hydratedData['invested_companies'] = $return;
     /** @Many */
     $mongoData = isset($data['category']) ? $data['category'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork, '$');
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['category']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['category']->setValue($document, $return);
     $hydratedData['category'] = $return;
     /** @Field(type="int") */
     if (isset($data['count'])) {
         $value = $data['count'];
         $return = (int) $value;
         $this->class->reflFields['count']->setValue($document, $return);
         $hydratedData['count'] = $return;
     }
     /** @Field(type="int") */
     if (isset($data['like'])) {
         $value = $data['like'];
         $return = (int) $value;
         $this->class->reflFields['like']->setValue($document, $return);
         $hydratedData['like'] = $return;
     }
     /** @Field(type="hash") */
     if (isset($data['attribute'])) {
         $value = $data['attribute'];
         $return = $value;
         $this->class->reflFields['attribute']->setValue($document, $return);
         $hydratedData['attribute'] = $return;
     }
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = (string) $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['created_at'])) {
         $value = $data['created_at'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['created_at']->setValue($document, clone $return);
         $hydratedData['created_at'] = $return;
     }
     /** @Field(type="date") */
     if (isset($data['updated_at'])) {
         $value = $data['updated_at'];
         if ($value instanceof \MongoDate) {
             $date = new \DateTime();
             $date->setTimestamp($value->sec);
             $return = $date;
         } else {
             $return = new \DateTime($value);
         }
         $this->class->reflFields['updated_at']->setValue($document, clone $return);
         $hydratedData['updated_at'] = $return;
     }
     return $hydratedData;
 }
 public function hydrate($document, $data, array $hints = array())
 {
     $hydratedData = array();
     /** @Field(type="id") */
     if (isset($data['_id'])) {
         $value = $data['_id'];
         $return = $value instanceof \MongoId ? (string) $value : $value;
         $this->class->reflFields['id']->setValue($document, $return);
         $hydratedData['id'] = $return;
     }
     /** @Field(type="string") */
     if (isset($data['tagline'])) {
         $value = $data['tagline'];
         $return = (string) $value;
         $this->class->reflFields['tagline']->setValue($document, $return);
         $hydratedData['tagline'] = $return;
     }
     /** @ReferenceOne */
     if (isset($data['image'])) {
         $reference = $data['image'];
         if (isset($this->class->fieldMappings['image']['simple']) && $this->class->fieldMappings['image']['simple']) {
             $className = $this->class->fieldMappings['image']['targetDocument'];
             $mongoId = $reference;
         } else {
             $className = $this->unitOfWork->getClassNameForAssociation($this->class->fieldMappings['image'], $reference);
             $mongoId = $reference['$id'];
         }
         $targetMetadata = $this->dm->getClassMetadata($className);
         $id = $targetMetadata->getPHPIdentifierValue($mongoId);
         $return = $this->dm->getReference($className, $id);
         $this->class->reflFields['image']->setValue($document, $return);
         $hydratedData['image'] = $return;
     }
     /** @EmbedOne */
     if (isset($data['address'])) {
         $embeddedDocument = $data['address'];
         $className = $this->unitOfWork->getClassNameForAssociation($this->class->fieldMappings['address'], $embeddedDocument);
         $embeddedMetadata = $this->dm->getClassMetadata($className);
         $return = $embeddedMetadata->newInstance();
         $embeddedData = $this->dm->getHydratorFactory()->hydrate($return, $embeddedDocument, $hints);
         $embeddedId = $embeddedMetadata->identifier && isset($embeddedData[$embeddedMetadata->identifier]) ? $embeddedData[$embeddedMetadata->identifier] : null;
         $this->unitOfWork->registerManaged($return, $embeddedId, $embeddedData);
         $this->unitOfWork->setParentAssociation($return, $this->class->fieldMappings['address'], $document, 'address');
         $this->class->reflFields['address']->setValue($document, $return);
         $hydratedData['address'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['occupation']) ? $data['occupation'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['occupation']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['occupation']->setValue($document, $return);
     $hydratedData['occupation'] = $return;
     /** @Many */
     $mongoData = isset($data['resumes']) ? $data['resumes'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['resumes']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['resumes']->setValue($document, $return);
     $hydratedData['resumes'] = $return;
     /** @Field(type="collection") */
     if (isset($data['documents'])) {
         $value = $data['documents'];
         $return = $value;
         $this->class->reflFields['documents']->setValue($document, $return);
         $hydratedData['documents'] = $return;
     }
     /** @Many */
     $mongoData = isset($data['albums']) ? $data['albums'] : null;
     $return = new \Doctrine\ODM\MongoDB\PersistentCollection(new \Doctrine\Common\Collections\ArrayCollection(), $this->dm, $this->unitOfWork);
     $return->setHints($hints);
     $return->setOwner($document, $this->class->fieldMappings['albums']);
     $return->setInitialized(false);
     if ($mongoData) {
         $return->setMongoData($mongoData);
     }
     $this->class->reflFields['albums']->setValue($document, $return);
     $hydratedData['albums'] = $return;
     return $hydratedData;
 }