/
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 AppDocumentPlaceHydrator 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['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="string") */ if (isset($data['nickname']) || (! empty($this->class->fieldMappings['nickname']['nullable']) && array_key_exists('nickname', $data))) { $value = $data['nickname']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['nickname']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['nickname']->setValue($document, $return); $hydratedData['nickname'] = $return; } /** @Field(type="string") */ if (isset($data['slug']) || (! empty($this->class->fieldMappings['slug']['nullable']) && array_key_exists('slug', $data))) { $value = $data['slug']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['slug']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['slug']->setValue($document, $return); $hydratedData['slug'] = $return; } /** @Field(type="string") */ if (isset($data['address']) || (! empty($this->class->fieldMappings['address']['nullable']) && array_key_exists('address', $data))) { $value = $data['address']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['address']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['address']->setValue($document, $return); $hydratedData['address'] = $return; } /** @Field(type="hash") */ if (isset($data['location']) || (! empty($this->class->fieldMappings['location']['nullable']) && array_key_exists('location', $data))) { $value = $data['location']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['location']['type']; $return = $value; } else { $return = null; } $this->class->reflFields['location']->setValue($document, $return); $hydratedData['location'] = $return; } /** @Field(type="string") */ if (isset($data['area']) || (! empty($this->class->fieldMappings['area']['nullable']) && array_key_exists('area', $data))) { $value = $data['area']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['area']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['area']->setValue($document, $return); $hydratedData['area'] = $return; } /** @Field(type="hash") */ if (isset($data['times']) || (! empty($this->class->fieldMappings['times']['nullable']) && array_key_exists('times', $data))) { $value = $data['times']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['times']['type']; $return = $value; } else { $return = null; } $this->class->reflFields['times']->setValue($document, $return); $hydratedData['times'] = $return; } /** @Field(type="string") */ if (isset($data['daily']) || (! empty($this->class->fieldMappings['daily']['nullable']) && array_key_exists('daily', $data))) { $value = $data['daily']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['daily']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['daily']->setValue($document, $return); $hydratedData['daily'] = $return; } /** @Field(type="string") */ if (isset($data['opening']) || (! empty($this->class->fieldMappings['opening']['nullable']) && array_key_exists('opening', $data))) { $value = $data['opening']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['opening']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['opening']->setValue($document, $return); $hydratedData['opening'] = $return; } /** @Field(type="string") */ if (isset($data['closing']) || (! empty($this->class->fieldMappings['closing']['nullable']) && array_key_exists('closing', $data))) { $value = $data['closing']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['closing']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['closing']->setValue($document, $return); $hydratedData['closing'] = $return; } /** @Field(type="collection") */ if (isset($data['daysopen']) || (! empty($this->class->fieldMappings['daysopen']['nullable']) && array_key_exists('daysopen', $data))) { $value = $data['daysopen']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['daysopen']['type']; $return = $value; } else { $return = null; } $this->class->reflFields['daysopen']->setValue($document, $return); $hydratedData['daysopen'] = $return; } /** @Field(type="collection") */ if (isset($data['tags']) || (! empty($this->class->fieldMappings['tags']['nullable']) && array_key_exists('tags', $data))) { $value = $data['tags']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['tags']['type']; $return = $value; } else { $return = null; } $this->class->reflFields['tags']->setValue($document, $return); $hydratedData['tags'] = $return; } /** @Field(type="string") */ if (isset($data['type']) || (! empty($this->class->fieldMappings['type']['nullable']) && array_key_exists('type', $data))) { $value = $data['type']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['type']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['type']->setValue($document, $return); $hydratedData['type'] = $return; } /** @Field(type="collection") */ if (isset($data['phones']) || (! empty($this->class->fieldMappings['phones']['nullable']) && array_key_exists('phones', $data))) { $value = $data['phones']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['phones']['type']; $return = $value; } else { $return = null; } $this->class->reflFields['phones']->setValue($document, $return); $hydratedData['phones'] = $return; } /** @Field(type="collection") */ if (isset($data['image']) || (! empty($this->class->fieldMappings['image']['nullable']) && array_key_exists('image', $data))) { $value = $data['image']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['image']['type']; $return = $value; } else { $return = null; } $this->class->reflFields['image']->setValue($document, $return); $hydratedData['image'] = $return; } /** @Field(type="collection") */ if (isset($data['category']) || (! empty($this->class->fieldMappings['category']['nullable']) && array_key_exists('category', $data))) { $value = $data['category']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['category']['type']; $return = $value; } else { $return = null; } $this->class->reflFields['category']->setValue($document, $return); $hydratedData['category'] = $return; } /** @Field(type="string") */ if (isset($data['owner']) || (! empty($this->class->fieldMappings['owner']['nullable']) && array_key_exists('owner', $data))) { $value = $data['owner']; if ($value !== null) { $typeIdentifier = $this->class->fieldMappings['owner']['type']; $return = (string) $value; } else { $return = null; } $this->class->reflFields['owner']->setValue($document, $return); $hydratedData['owner'] = $return; } return $hydratedData; } }