vendor/shopware/core/Content/Category/CategoryHydrator.php line 13

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Category;
  3. use Shopware\Core\Framework\Context;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Dbal\EntityHydrator;
  5. use Shopware\Core\Framework\DataAbstractionLayer\Entity;
  6. use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
  7. use Shopware\Core\Framework\Uuid\Uuid;
  8. class CategoryHydrator extends EntityHydrator
  9. {
  10.     protected function assign(EntityDefinition $definitionEntity $entitystring $root, array $rowContext $context): Entity
  11.     {
  12.         if (isset($row[$root '.id'])) {
  13.             $entity->id Uuid::fromBytesToHex($row[$root '.id']);
  14.         }
  15.         if (isset($row[$root '.versionId'])) {
  16.             $entity->versionId Uuid::fromBytesToHex($row[$root '.versionId']);
  17.         }
  18.         if (isset($row[$root '.parentId'])) {
  19.             $entity->parentId Uuid::fromBytesToHex($row[$root '.parentId']);
  20.         }
  21.         if (isset($row[$root '.afterCategoryId'])) {
  22.             $entity->afterCategoryId Uuid::fromBytesToHex($row[$root '.afterCategoryId']);
  23.         }
  24.         if (isset($row[$root '.mediaId'])) {
  25.             $entity->mediaId Uuid::fromBytesToHex($row[$root '.mediaId']);
  26.         }
  27.         if (isset($row[$root '.displayNestedProducts'])) {
  28.             $entity->displayNestedProducts = (bool) $row[$root '.displayNestedProducts'];
  29.         }
  30.         if (isset($row[$root '.autoIncrement'])) {
  31.             $entity->autoIncrement = (int) $row[$root '.autoIncrement'];
  32.         }
  33.         if (isset($row[$root '.level'])) {
  34.             $entity->level = (int) $row[$root '.level'];
  35.         }
  36.         if (\array_key_exists($root '.path'$row)) {
  37.             $entity->path $definition->decode('path'self::value($row$root'path'));
  38.         }
  39.         if (isset($row[$root '.childCount'])) {
  40.             $entity->childCount = (int) $row[$root '.childCount'];
  41.         }
  42.         if (isset($row[$root '.type'])) {
  43.             $entity->type $row[$root '.type'];
  44.         }
  45.         if (isset($row[$root '.productAssignmentType'])) {
  46.             $entity->productAssignmentType $row[$root '.productAssignmentType'];
  47.         }
  48.         if (isset($row[$root '.visible'])) {
  49.             $entity->visible = (bool) $row[$root '.visible'];
  50.         }
  51.         if (isset($row[$root '.active'])) {
  52.             $entity->active = (bool) $row[$root '.active'];
  53.         }
  54.         if (isset($row[$root '.cmsPageId'])) {
  55.             $entity->cmsPageId Uuid::fromBytesToHex($row[$root '.cmsPageId']);
  56.         }
  57.         if (isset($row[$root '.productStreamId'])) {
  58.             $entity->productStreamId Uuid::fromBytesToHex($row[$root '.productStreamId']);
  59.         }
  60.         if (isset($row[$root '.createdAt'])) {
  61.             $entity->createdAt = new \DateTimeImmutable($row[$root '.createdAt']);
  62.         }
  63.         if (isset($row[$root '.updatedAt'])) {
  64.             $entity->updatedAt = new \DateTimeImmutable($row[$root '.updatedAt']);
  65.         }
  66.         $entity->media $this->manyToOne($row$root$definition->getField('media'), $context);
  67.         $entity->cmsPage $this->manyToOne($row$root$definition->getField('cmsPage'), $context);
  68.         $entity->productStream $this->manyToOne($row$root$definition->getField('productStream'), $context);
  69.         $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
  70.         $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());
  71.         $this->customFields($definition$row$root$entity$definition->getField('customFields'), $context);
  72.         $this->manyToMany($row$root$entity$definition->getField('products'));
  73.         $this->manyToMany($row$root$entity$definition->getField('nestedProducts'));
  74.         $this->manyToMany($row$root$entity$definition->getField('tags'));
  75.         return $entity;
  76.     }
  77. }