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

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