var/cache/dev/doctrine/odm/mongodb/Hydrators/AppAdminDocumentHubHydrator.php line 28

Open in your IDE?
  1. <?php
  2. namespace Hydrators;
  3. use Doctrine\ODM\MongoDB\DocumentManager;
  4. use Doctrine\ODM\MongoDB\Hydrator\HydratorException;
  5. use Doctrine\ODM\MongoDB\Hydrator\HydratorInterface;
  6. use Doctrine\ODM\MongoDB\Query\Query;
  7. use Doctrine\ODM\MongoDB\UnitOfWork;
  8. use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
  9. /**
  10.  * THIS CLASS WAS GENERATED BY THE DOCTRINE ODM. DO NOT EDIT THIS FILE.
  11.  */
  12. class AppAdminDocumentHubHydrator implements HydratorInterface
  13. {
  14.     private $dm;
  15.     private $unitOfWork;
  16.     private $class;
  17.     public function __construct(DocumentManager $dmUnitOfWork $uowClassMetadata $class)
  18.     {
  19.         $this->dm $dm;
  20.         $this->unitOfWork $uow;
  21.         $this->class $class;
  22.     }
  23.     public function hydrate(object $document, array $data, array $hints = array()): array
  24.     {
  25.         $hydratedData = array();
  26.         $mapping $this->class->fieldMappings['chain'];
  27.         $className $mapping['targetDocument'];
  28.         $targetClass $this->dm->getClassMetadata($mapping['targetDocument']);
  29.         $mappedByMapping $targetClass->fieldMappings[$mapping['mappedBy']];
  30.         $mappedByFieldName ClassMetadata::getReferenceFieldName($mappedByMapping['storeAs'], $mapping['mappedBy']);
  31.         $criteria array_merge(
  32.             array($mappedByFieldName => $data['_id']),
  33.             isset($this->class->fieldMappings['chain']['criteria']) ? $this->class->fieldMappings['chain']['criteria'] : array()
  34.         );
  35.         $sort = isset($this->class->fieldMappings['chain']['sort']) ? $this->class->fieldMappings['chain']['sort'] : array();
  36.         $return $this->unitOfWork->getDocumentPersister($className)->load($criterianull, array(), 0$sort);
  37.         $this->class->reflFields['chain']->setValue($document$return);
  38.         $hydratedData['chain'] = $return;
  39.         /** @Field(type="string") */
  40.         if (isset($data['workingTime']) || (! empty($this->class->fieldMappings['workingTime']['nullable']) && array_key_exists('workingTime'$data))) {
  41.             $value $data['workingTime'];
  42.             if ($value !== null) {
  43.                 $typeIdentifier $this->class->fieldMappings['workingTime']['type'];
  44.                 $return = (string) $value;
  45.             } else {
  46.                 $return null;
  47.             }
  48.             $this->class->reflFields['workingTime']->setValue($document$return);
  49.             $hydratedData['workingTime'] = $return;
  50.         }
  51.         /** @Field(type="string") */
  52.         if (isset($data['address']) || (! empty($this->class->fieldMappings['address']['nullable']) && array_key_exists('address'$data))) {
  53.             $value $data['address'];
  54.             if ($value !== null) {
  55.                 $typeIdentifier $this->class->fieldMappings['address']['type'];
  56.                 $return = (string) $value;
  57.             } else {
  58.                 $return null;
  59.             }
  60.             $this->class->reflFields['address']->setValue($document$return);
  61.             $hydratedData['address'] = $return;
  62.         }
  63.         /** @Field(type="string") */
  64.         if (isset($data['coordinates']) || (! empty($this->class->fieldMappings['coordinates']['nullable']) && array_key_exists('coordinates'$data))) {
  65.             $value $data['coordinates'];
  66.             if ($value !== null) {
  67.                 $typeIdentifier $this->class->fieldMappings['coordinates']['type'];
  68.                 $return = (string) $value;
  69.             } else {
  70.                 $return null;
  71.             }
  72.             $this->class->reflFields['coordinates']->setValue($document$return);
  73.             $hydratedData['coordinates'] = $return;
  74.         }
  75.         /** @Field(type="string") */
  76.         if (isset($data['map']) || (! empty($this->class->fieldMappings['map']['nullable']) && array_key_exists('map'$data))) {
  77.             $value $data['map'];
  78.             if ($value !== null) {
  79.                 $typeIdentifier $this->class->fieldMappings['map']['type'];
  80.                 $return = (string) $value;
  81.             } else {
  82.                 $return null;
  83.             }
  84.             $this->class->reflFields['map']->setValue($document$return);
  85.             $hydratedData['map'] = $return;
  86.         }
  87.         /** @Field(type="string") */
  88.         if (isset($data['delivery']) || (! empty($this->class->fieldMappings['delivery']['nullable']) && array_key_exists('delivery'$data))) {
  89.             $value $data['delivery'];
  90.             if ($value !== null) {
  91.                 $typeIdentifier $this->class->fieldMappings['delivery']['type'];
  92.                 $return = (string) $value;
  93.             } else {
  94.                 $return null;
  95.             }
  96.             $this->class->reflFields['delivery']->setValue($document$return);
  97.             $hydratedData['delivery'] = $return;
  98.         }
  99.         /** @Field(type="string") */
  100.         if (isset($data['assembly']) || (! empty($this->class->fieldMappings['assembly']['nullable']) && array_key_exists('assembly'$data))) {
  101.             $value $data['assembly'];
  102.             if ($value !== null) {
  103.                 $typeIdentifier $this->class->fieldMappings['assembly']['type'];
  104.                 $return = (string) $value;
  105.             } else {
  106.                 $return null;
  107.             }
  108.             $this->class->reflFields['assembly']->setValue($document$return);
  109.             $hydratedData['assembly'] = $return;
  110.         }
  111.         /** @Field(type="string") */
  112.         if (isset($data['documents']) || (! empty($this->class->fieldMappings['documents']['nullable']) && array_key_exists('documents'$data))) {
  113.             $value $data['documents'];
  114.             if ($value !== null) {
  115.                 $typeIdentifier $this->class->fieldMappings['documents']['type'];
  116.                 $return = (string) $value;
  117.             } else {
  118.                 $return null;
  119.             }
  120.             $this->class->reflFields['documents']->setValue($document$return);
  121.             $hydratedData['documents'] = $return;
  122.         }
  123.         /** @Field(type="hash") */
  124.         if (isset($data['features']) || (! empty($this->class->fieldMappings['features']['nullable']) && array_key_exists('features'$data))) {
  125.             $value $data['features'];
  126.             if ($value !== null) {
  127.                 $typeIdentifier $this->class->fieldMappings['features']['type'];
  128.                 $return $value;
  129.             } else {
  130.                 $return null;
  131.             }
  132.             $this->class->reflFields['features']->setValue($document$return);
  133.             $hydratedData['features'] = $return;
  134.         }
  135.         /** @Field(type="hash") */
  136.         if (isset($data['acceptanceItems']) || (! empty($this->class->fieldMappings['acceptanceItems']['nullable']) && array_key_exists('acceptanceItems'$data))) {
  137.             $value $data['acceptanceItems'];
  138.             if ($value !== null) {
  139.                 $typeIdentifier $this->class->fieldMappings['acceptanceItems']['type'];
  140.                 $return $value;
  141.             } else {
  142.                 $return null;
  143.             }
  144.             $this->class->reflFields['acceptanceItems']->setValue($document$return);
  145.             $hydratedData['acceptanceItems'] = $return;
  146.         }
  147.         /** @Field(type="hash") */
  148.         if (isset($data['rules']) || (! empty($this->class->fieldMappings['rules']['nullable']) && array_key_exists('rules'$data))) {
  149.             $value $data['rules'];
  150.             if ($value !== null) {
  151.                 $typeIdentifier $this->class->fieldMappings['rules']['type'];
  152.                 $return $value;
  153.             } else {
  154.                 $return null;
  155.             }
  156.             $this->class->reflFields['rules']->setValue($document$return);
  157.             $hydratedData['rules'] = $return;
  158.         }
  159.         /** @Many */
  160.         $mongoData = isset($data['maps']) ? $data['maps'] : null;
  161.         if ($mongoData !== null && ! is_array($mongoData)) {
  162.             throw HydratorException::associationTypeMismatch('App\Admin\Document\Hub''maps''array'gettype($mongoData));
  163.         }
  164.         $return $this->dm->getConfiguration()->getPersistentCollectionFactory()->create($this->dm$this->class->fieldMappings['maps']);
  165.         $return->setHints($hints);
  166.         $return->setOwner($document$this->class->fieldMappings['maps']);
  167.         $return->setInitialized(false);
  168.         if ($mongoData) {
  169.             $return->setMongoData($mongoData);
  170.         }
  171.         $this->class->reflFields['maps']->setValue($document$return);
  172.         $hydratedData['maps'] = $return;
  173.         /** @Many */
  174.         $mongoData = isset($data['contacts']) ? $data['contacts'] : null;
  175.         if ($mongoData !== null && ! is_array($mongoData)) {
  176.             throw HydratorException::associationTypeMismatch('App\Admin\Document\Hub''contacts''array'gettype($mongoData));
  177.         }
  178.         $return $this->dm->getConfiguration()->getPersistentCollectionFactory()->create($this->dm$this->class->fieldMappings['contacts']);
  179.         $return->setHints($hints);
  180.         $return->setOwner($document$this->class->fieldMappings['contacts']);
  181.         $return->setInitialized(false);
  182.         if ($mongoData) {
  183.             $return->setMongoData($mongoData);
  184.         }
  185.         $this->class->reflFields['contacts']->setValue($document$return);
  186.         $hydratedData['contacts'] = $return;
  187.         /** @Many */
  188.         $mongoData = isset($data['workingTimes']) ? $data['workingTimes'] : null;
  189.         if ($mongoData !== null && ! is_array($mongoData)) {
  190.             throw HydratorException::associationTypeMismatch('App\Admin\Document\Hub''workingTimes''array'gettype($mongoData));
  191.         }
  192.         $return $this->dm->getConfiguration()->getPersistentCollectionFactory()->create($this->dm$this->class->fieldMappings['workingTimes']);
  193.         $return->setHints($hints);
  194.         $return->setOwner($document$this->class->fieldMappings['workingTimes']);
  195.         $return->setInitialized(false);
  196.         if ($mongoData) {
  197.             $return->setMongoData($mongoData);
  198.         }
  199.         $this->class->reflFields['workingTimes']->setValue($document$return);
  200.         $hydratedData['workingTimes'] = $return;
  201.         /** @Field(type="id") */
  202.         if (isset($data['_id']) || (! empty($this->class->fieldMappings['id']['nullable']) && array_key_exists('_id'$data))) {
  203.             $value $data['_id'];
  204.             if ($value !== null) {
  205.                 $typeIdentifier $this->class->fieldMappings['id']['type'];
  206.                 $return $value instanceof \MongoDB\BSON\ObjectId ? (string) $value $value;
  207.             } else {
  208.                 $return null;
  209.             }
  210.             $this->class->reflFields['id']->setValue($document$return);
  211.             $hydratedData['id'] = $return;
  212.         }
  213.         /** @Field(type="boolean") */
  214.         if (isset($data['active']) || (! empty($this->class->fieldMappings['active']['nullable']) && array_key_exists('active'$data))) {
  215.             $value $data['active'];
  216.             if ($value !== null) {
  217.                 $typeIdentifier $this->class->fieldMappings['active']['type'];
  218.                 $return = (bool) $value;
  219.             } else {
  220.                 $return null;
  221.             }
  222.             $this->class->reflFields['active']->setValue($document$return);
  223.             $hydratedData['active'] = $return;
  224.         }
  225.         /** @Field(type="collection") */
  226.         if (isset($data['images']) || (! empty($this->class->fieldMappings['images']['nullable']) && array_key_exists('images'$data))) {
  227.             $value $data['images'];
  228.             if ($value !== null) {
  229.                 $typeIdentifier $this->class->fieldMappings['images']['type'];
  230.                 $return $value;
  231.             } else {
  232.                 $return null;
  233.             }
  234.             $this->class->reflFields['images']->setValue($document$return);
  235.             $hydratedData['images'] = $return;
  236.         }
  237.         /** @Field(type="string") */
  238.         if (isset($data['name']) || (! empty($this->class->fieldMappings['name']['nullable']) && array_key_exists('name'$data))) {
  239.             $value $data['name'];
  240.             if ($value !== null) {
  241.                 $typeIdentifier $this->class->fieldMappings['name']['type'];
  242.                 $return = (string) $value;
  243.             } else {
  244.                 $return null;
  245.             }
  246.             $this->class->reflFields['name']->setValue($document$return);
  247.             $hydratedData['name'] = $return;
  248.         }
  249.         return $hydratedData;
  250.     }
  251. }