/
home
/
obinna
/
html
/
restaurants
/
var
/
cache
/
dev
/
doctrine
/
odm
/
mongodb
/
Hydrators
/
Upload File
HOME
<?php namespace Hydrators; use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\Hydrator\HydratorException; use Doctrine\ODM\MongoDB\Hydrator\HydratorInterface; use Doctrine\ODM\MongoDB\Query\Query; use Doctrine\ODM\MongoDB\UnitOfWork; use Doctrine\ODM\MongoDB\Mapping\ClassMetadata; /** * THIS CLASS WAS GENERATED BY THE DOCTRINE ODM. DO NOT EDIT THIS FILE. */ class AppDocumentUserHydrator implements HydratorInterface { private $dm; private $unitOfWork; private $class; public function __construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $class) { $this->dm = $dm; $this->unitOfWork = $uow; $this->class = $class; } public function hydrate(object $document, array $data, array $hints = array()): array { $hydratedData = array(); /** @Field(type="id") */ if (isset($data['_id']) || (! empty($this->class->fieldMappings['id']['nullable']) && array_key_exists('_id', $data))) { $value = $data['_id']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['id']['type']; $return = $value instanceof \MongoDB\BSON\ObjectId ? (string) $value : $value; } else { $return = null; } $this->class->reflFields['id']->setValue($document, $return); $hydratedData['id'] = $return; } /** @Field(type="string") */ if (isset($data['email']) || (! empty($this->class->fieldMappings['email']['nullable']) && array_key_exists('email', $data))) { $value = $data['email']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['email']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['email']->setValue($document, $return); $hydratedData['email'] = $return; } /** @Field(type="string") */ if (isset($data['name']) || (! empty($this->class->fieldMappings['name']['nullable']) && array_key_exists('name', $data))) { $value = $data['name']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['name']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['name']->setValue($document, $return); $hydratedData['name'] = $return; } /** @Field(type="collection") */ if (isset($data['roles']) || (! empty($this->class->fieldMappings['roles']['nullable']) && array_key_exists('roles', $data))) { $value = $data['roles']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['roles']['type']; $return = $value; } else { $return = null; } $this->class->reflFields['roles']->setValue($document, $return); $hydratedData['roles'] = $return; } /** @Field(type="string") */ if (isset($data['password']) || (! empty($this->class->fieldMappings['password']['nullable']) && array_key_exists('password', $data))) { $value = $data['password']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['password']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['password']->setValue($document, $return); $hydratedData['password'] = $return; } /** @Field(type="string") */ if (isset($data['verification']) || (! empty($this->class->fieldMappings['verification']['nullable']) && array_key_exists('verification', $data))) { $value = $data['verification']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['verification']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['verification']->setValue($document, $return); $hydratedData['verification'] = $return; } /** @Field(type="string") */ if (isset($data['reset']) || (! empty($this->class->fieldMappings['reset']['nullable']) && array_key_exists('reset', $data))) { $value = $data['reset']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['reset']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['reset']->setValue($document, $return); $hydratedData['reset'] = $return; } /** @Field(type="string") */ if (isset($data['telephone']) || (! empty($this->class->fieldMappings['telephone']['nullable']) && array_key_exists('telephone', $data))) { $value = $data['telephone']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['telephone']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['telephone']->setValue($document, $return); $hydratedData['telephone'] = $return; } /** @Field(type="bool") */ if (isset($data['enabled']) || (! empty($this->class->fieldMappings['enabled']['nullable']) && array_key_exists('enabled', $data))) { $value = $data['enabled']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['enabled']['type']; $return = (bool) $value; } else { $return = null; } $this->class->reflFields['enabled']->setValue($document, $return); $hydratedData['enabled'] = $return; } /** @Field(type="string") */ if (isset($data['created']) || (! empty($this->class->fieldMappings['created']['nullable']) && array_key_exists('created', $data))) { $value = $data['created']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['created']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['created']->setValue($document, $return); $hydratedData['created'] = $return; } /** @Field(type="string") */ if (isset($data['modified']) || (! empty($this->class->fieldMappings['modified']['nullable']) && array_key_exists('modified', $data))) { $value = $data['modified']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['modified']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['modified']->setValue($document, $return); $hydratedData['modified'] = $return; } /** @Field(type="int") */ if (isset($data['subscription']) || (! empty($this->class->fieldMappings['subscription']['nullable']) && array_key_exists('subscription', $data))) { $value = $data['subscription']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['subscription']['type']; $return = (int) $value; } else { $return = null; } $this->class->reflFields['subscription']->setValue($document, $return); $hydratedData['subscription'] = $return; } /** @Field(type="string") */ if (isset($data['paystack_code']) || (! empty($this->class->fieldMappings['paystack_code']['nullable']) && array_key_exists('paystack_code', $data))) { $value = $data['paystack_code']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['paystack_code']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['paystack_code']->setValue($document, $return); $hydratedData['paystack_code'] = $return; } /** @Field(type="string") */ if (isset($data['paystack_auth']) || (! empty($this->class->fieldMappings['paystack_auth']['nullable']) && array_key_exists('paystack_auth', $data))) { $value = $data['paystack_auth']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['paystack_auth']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['paystack_auth']->setValue($document, $return); $hydratedData['paystack_auth'] = $return; } return $hydratedData; } }