vendor/shopware/core/Content/Cms/Aggregate/CmsSlot/CmsSlotEntity.php line 15

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Cms\Aggregate\CmsSlot;
  3. use Shopware\Core\Content\Cms\Aggregate\CmsBlock\CmsBlockEntity;
  4. use Shopware\Core\Content\Cms\Aggregate\CmsSlotTranslation\CmsSlotTranslationEntity;
  5. use Shopware\Core\Content\Cms\DataResolver\FieldConfig;
  6. use Shopware\Core\Content\Cms\DataResolver\FieldConfigCollection;
  7. use Shopware\Core\Framework\DataAbstractionLayer\Entity;
  8. use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
  9. use Shopware\Core\Framework\DataAbstractionLayer\EntityCustomFieldsTrait;
  10. use Shopware\Core\Framework\DataAbstractionLayer\EntityIdTrait;
  11. use Shopware\Core\Framework\Struct\Struct;
  12. class CmsSlotEntity extends Entity
  13. {
  14.     use EntityIdTrait;
  15.     use EntityCustomFieldsTrait;
  16.     /**
  17.      * @var string
  18.      */
  19.     protected $type;
  20.     /**
  21.      * @var string
  22.      */
  23.     protected $slot;
  24.     /**
  25.      * @var CmsBlockEntity|null
  26.      */
  27.     protected $block;
  28.     /**
  29.      * @var string
  30.      */
  31.     protected $blockId;
  32.     /**
  33.      * @var array|null
  34.      */
  35.     protected $config;
  36.     /**
  37.      * @var FieldConfigCollection|null
  38.      *
  39.      * @internal
  40.      */
  41.     protected $fieldConfig;
  42.     /**
  43.      * @var EntityCollection<CmsSlotTranslationEntity>|null
  44.      */
  45.     protected $translations;
  46.     /**
  47.      * @var Struct|null
  48.      */
  49.     protected $data;
  50.     /**
  51.      * @var bool
  52.      */
  53.     protected $locked;
  54.     /**
  55.      * @var string|null
  56.      */
  57.     protected $cmsBlockVersionId;
  58.     public function getType(): string
  59.     {
  60.         return $this->type;
  61.     }
  62.     public function setType(string $type): void
  63.     {
  64.         $this->type $type;
  65.     }
  66.     public function getSlot(): string
  67.     {
  68.         return $this->slot;
  69.     }
  70.     public function setSlot(string $slot): void
  71.     {
  72.         $this->slot $slot;
  73.     }
  74.     public function getBlock(): ?CmsBlockEntity
  75.     {
  76.         return $this->block;
  77.     }
  78.     public function setBlock(CmsBlockEntity $block): void
  79.     {
  80.         $this->block $block;
  81.     }
  82.     public function getBlockId(): string
  83.     {
  84.         return $this->blockId;
  85.     }
  86.     public function setBlockId(string $blockId): void
  87.     {
  88.         $this->blockId $blockId;
  89.     }
  90.     public function getConfig(): ?array
  91.     {
  92.         return $this->config;
  93.     }
  94.     public function setConfig(array $config): void
  95.     {
  96.         $this->config $config;
  97.         $this->fieldConfig null;
  98.     }
  99.     /**
  100.      * @return EntityCollection<CmsSlotTranslationEntity>|null
  101.      */
  102.     public function getTranslations(): ?EntityCollection
  103.     {
  104.         return $this->translations;
  105.     }
  106.     /**
  107.      * @param EntityCollection<CmsSlotTranslationEntity> $translations
  108.      */
  109.     public function setTranslations(EntityCollection $translations): void
  110.     {
  111.         $this->translations $translations;
  112.     }
  113.     public function getData(): ?Struct
  114.     {
  115.         return $this->data;
  116.     }
  117.     public function setData(Struct $data): void
  118.     {
  119.         $this->data $data;
  120.     }
  121.     public function getLocked(): bool
  122.     {
  123.         return $this->locked;
  124.     }
  125.     public function setLocked(bool $locked): void
  126.     {
  127.         $this->locked $locked;
  128.     }
  129.     public function getFieldConfig(): FieldConfigCollection
  130.     {
  131.         if ($this->fieldConfig) {
  132.             return $this->fieldConfig;
  133.         }
  134.         $collection = new FieldConfigCollection();
  135.         $config $this->getTranslation('config') ?? [];
  136.         foreach ($config as $key => $value) {
  137.             $collection->add(
  138.                 new FieldConfig($key$value['source'], $value['value'])
  139.             );
  140.         }
  141.         return $this->fieldConfig $collection;
  142.     }
  143.     public function setFieldConfig(FieldConfigCollection $fieldConfig): void
  144.     {
  145.         $this->fieldConfig $fieldConfig;
  146.     }
  147.     public function getCmsBlockVersionId(): ?string
  148.     {
  149.         return $this->cmsBlockVersionId;
  150.     }
  151.     public function setCmsBlockVersionId(?string $cmsBlockVersionId): void
  152.     {
  153.         $this->cmsBlockVersionId $cmsBlockVersionId;
  154.     }
  155. }