vendor/shopware/core/Content/Media/MediaEntity.php line 27

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Media;
  3. use Shopware\Core\Checkout\Document\Aggregate\DocumentBaseConfig\DocumentBaseConfigCollection;
  4. use Shopware\Core\Checkout\Document\DocumentCollection;
  5. use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemCollection;
  6. use Shopware\Core\Checkout\Payment\PaymentMethodCollection;
  7. use Shopware\Core\Checkout\Shipping\ShippingMethodCollection;
  8. use Shopware\Core\Content\Category\CategoryCollection;
  9. use Shopware\Core\Content\Cms\Aggregate\CmsBlock\CmsBlockCollection;
  10. use Shopware\Core\Content\Cms\Aggregate\CmsSection\CmsSectionCollection;
  11. use Shopware\Core\Content\MailTemplate\Aggregate\MailTemplateMedia\MailTemplateMediaCollection;
  12. use Shopware\Core\Content\Media\Aggregate\MediaFolder\MediaFolderEntity;
  13. use Shopware\Core\Content\Media\Aggregate\MediaThumbnail\MediaThumbnailCollection;
  14. use Shopware\Core\Content\Media\Aggregate\MediaTranslation\MediaTranslationCollection;
  15. use Shopware\Core\Content\Media\MediaType\MediaType;
  16. use Shopware\Core\Content\Product\Aggregate\ProductConfiguratorSetting\ProductConfiguratorSettingCollection;
  17. use Shopware\Core\Content\Product\Aggregate\ProductManufacturer\ProductManufacturerCollection;
  18. use Shopware\Core\Content\Product\Aggregate\ProductMedia\ProductMediaCollection;
  19. use Shopware\Core\Content\Property\Aggregate\PropertyGroupOption\PropertyGroupOptionCollection;
  20. use Shopware\Core\Framework\DataAbstractionLayer\Entity;
  21. use Shopware\Core\Framework\DataAbstractionLayer\EntityIdTrait;
  22. use Shopware\Core\System\Tag\TagCollection;
  23. use Shopware\Core\System\User\UserEntity;
  24. class MediaEntity extends Entity
  25. {
  26.     use EntityIdTrait;
  27.     /**
  28.      * @var string|null
  29.      */
  30.     protected $userId;
  31.     /**
  32.      * @var string|null
  33.      */
  34.     protected $mimeType;
  35.     /**
  36.      * @var string|null
  37.      */
  38.     protected $fileExtension;
  39.     /**
  40.      * @var int|null
  41.      */
  42.     protected $fileSize;
  43.     /**
  44.      * @var string|null
  45.      */
  46.     protected $title;
  47.     /**
  48.      * @var string|null
  49.      */
  50.     protected $metaDataRaw;
  51.     /**
  52.      * @var string|null
  53.      */
  54.     protected $mediaTypeRaw;
  55.     /**
  56.      * @var array|null
  57.      */
  58.     protected $metaData;
  59.     /**
  60.      * @var MediaType|null
  61.      */
  62.     protected $mediaType;
  63.     /**
  64.      * @var \DateTimeInterface|null
  65.      */
  66.     protected $uploadedAt;
  67.     /**
  68.      * @var string|null
  69.      */
  70.     protected $alt;
  71.     /**
  72.      * @var string
  73.      */
  74.     protected $url '';
  75.     /**
  76.      * @var string|null
  77.      */
  78.     protected $fileName;
  79.     /**
  80.      * @var UserEntity|null
  81.      */
  82.     protected $user;
  83.     /**
  84.      * @var MediaTranslationCollection|null
  85.      */
  86.     protected $translations;
  87.     /**
  88.      * @var CategoryCollection|null
  89.      */
  90.     protected $categories;
  91.     /**
  92.      * @var ProductManufacturerCollection|null
  93.      */
  94.     protected $productManufacturers;
  95.     /**
  96.      * @var ProductMediaCollection|null
  97.      */
  98.     protected $productMedia;
  99.     /**
  100.      * @var UserEntity|null
  101.      */
  102.     protected $avatarUser;
  103.     /**
  104.      * @var MediaThumbnailCollection|null
  105.      */
  106.     protected $thumbnails;
  107.     /**
  108.      * @var string|null
  109.      */
  110.     protected $mediaFolderId;
  111.     /**
  112.      * @var MediaFolderEntity|null
  113.      */
  114.     protected $mediaFolder;
  115.     /**
  116.      * @var bool
  117.      */
  118.     protected $hasFile false;
  119.     /**
  120.      * @var bool
  121.      */
  122.     protected $private false;
  123.     /**
  124.      * @var PropertyGroupOptionCollection|null
  125.      */
  126.     protected $propertyGroupOptions;
  127.     /**
  128.      * @var MailTemplateMediaCollection|null
  129.      */
  130.     protected $mailTemplateMedia;
  131.     /**
  132.      * @var array|null
  133.      */
  134.     protected $customFields;
  135.     /**
  136.      * @var TagCollection|null
  137.      */
  138.     protected $tags;
  139.     /**
  140.      * @var string|null
  141.      */
  142.     protected $thumbnailsRo;
  143.     /**
  144.      * @var DocumentBaseConfigCollection|null
  145.      */
  146.     protected $documentBaseConfigs;
  147.     /**
  148.      * @var ShippingMethodCollection|null
  149.      */
  150.     protected $shippingMethods;
  151.     /**
  152.      * @var PaymentMethodCollection|null
  153.      */
  154.     protected $paymentMethods;
  155.     /**
  156.      * @var ProductConfiguratorSettingCollection|null
  157.      */
  158.     protected $productConfiguratorSettings;
  159.     /**
  160.      * @var OrderLineItemCollection|null
  161.      */
  162.     protected $orderLineItems;
  163.     /**
  164.      * @var CmsBlockCollection|null
  165.      */
  166.     protected $cmsBlocks;
  167.     /**
  168.      * @var CmsSectionCollection|null
  169.      */
  170.     protected $cmsSections;
  171.     /**
  172.      * @var CmsBlockCollection|null
  173.      */
  174.     protected $cmsPages;
  175.     /**
  176.      * @var DocumentCollection|null
  177.      */
  178.     protected $documents;
  179.     public function get(string $property)
  180.     {
  181.         if ($property === 'hasFile') {
  182.             return $this->hasFile();
  183.         }
  184.         return parent::get($property);
  185.     }
  186.     public function getUserId(): ?string
  187.     {
  188.         return $this->userId;
  189.     }
  190.     public function setUserId(string $userId): void
  191.     {
  192.         $this->userId $userId;
  193.     }
  194.     public function getMimeType(): ?string
  195.     {
  196.         return $this->mimeType;
  197.     }
  198.     public function setMimeType(string $mimeType): void
  199.     {
  200.         $this->mimeType $mimeType;
  201.     }
  202.     public function getFileExtension(): ?string
  203.     {
  204.         return $this->fileExtension;
  205.     }
  206.     public function setFileExtension(string $fileExtension): void
  207.     {
  208.         $this->fileExtension $fileExtension;
  209.     }
  210.     public function getFileSize(): ?int
  211.     {
  212.         return $this->fileSize;
  213.     }
  214.     public function setFileSize(int $fileSize): void
  215.     {
  216.         $this->fileSize $fileSize;
  217.     }
  218.     public function getTitle(): ?string
  219.     {
  220.         return $this->title;
  221.     }
  222.     public function setTitle(string $title): void
  223.     {
  224.         $this->title $title;
  225.     }
  226.     public function getMetaData(): ?array
  227.     {
  228.         return $this->metaData;
  229.     }
  230.     public function setMetaData(array $metaData): void
  231.     {
  232.         $this->metaData $metaData;
  233.     }
  234.     public function getMediaType(): ?MediaType
  235.     {
  236.         return $this->mediaType;
  237.     }
  238.     public function setMediaType(MediaType $mediaType): void
  239.     {
  240.         $this->mediaType $mediaType;
  241.     }
  242.     public function getUploadedAt(): ?\DateTimeInterface
  243.     {
  244.         return $this->uploadedAt;
  245.     }
  246.     public function setUploadedAt(\DateTimeInterface $uploadedAt): void
  247.     {
  248.         $this->uploadedAt $uploadedAt;
  249.     }
  250.     public function getAlt(): ?string
  251.     {
  252.         return $this->alt;
  253.     }
  254.     public function setAlt(string $alt): void
  255.     {
  256.         $this->alt $alt;
  257.     }
  258.     public function getUser(): ?UserEntity
  259.     {
  260.         return $this->user;
  261.     }
  262.     public function setUser(UserEntity $user): void
  263.     {
  264.         $this->user $user;
  265.     }
  266.     public function getTranslations(): ?MediaTranslationCollection
  267.     {
  268.         return $this->translations;
  269.     }
  270.     public function setTranslations(MediaTranslationCollection $translations): void
  271.     {
  272.         $this->translations $translations;
  273.     }
  274.     public function getCategories(): ?CategoryCollection
  275.     {
  276.         return $this->categories;
  277.     }
  278.     public function setCategories(CategoryCollection $categories): void
  279.     {
  280.         $this->categories $categories;
  281.     }
  282.     public function getProductManufacturers(): ?ProductManufacturerCollection
  283.     {
  284.         return $this->productManufacturers;
  285.     }
  286.     public function setProductManufacturers(ProductManufacturerCollection $productManufacturers): void
  287.     {
  288.         $this->productManufacturers $productManufacturers;
  289.     }
  290.     public function getProductMedia(): ?ProductMediaCollection
  291.     {
  292.         return $this->productMedia;
  293.     }
  294.     public function setProductMedia(ProductMediaCollection $productMedia): void
  295.     {
  296.         $this->productMedia $productMedia;
  297.     }
  298.     public function getAvatarUser(): ?UserEntity
  299.     {
  300.         return $this->avatarUser;
  301.     }
  302.     public function setAvatarUser(UserEntity $avatarUser): void
  303.     {
  304.         $this->avatarUser $avatarUser;
  305.     }
  306.     public function getThumbnails(): ?MediaThumbnailCollection
  307.     {
  308.         return $this->thumbnails;
  309.     }
  310.     public function setThumbnails(MediaThumbnailCollection $thumbnailCollection): void
  311.     {
  312.         $this->thumbnails $thumbnailCollection;
  313.     }
  314.     public function getUrl(): string
  315.     {
  316.         return $this->url;
  317.     }
  318.     public function setUrl(string $url): void
  319.     {
  320.         $this->url $url;
  321.     }
  322.     public function hasFile(): bool
  323.     {
  324.         $hasFile $this->mimeType !== null && $this->fileExtension !== null && $this->fileName !== null;
  325.         return $this->hasFile $hasFile;
  326.     }
  327.     public function getFileName(): ?string
  328.     {
  329.         return $this->fileName;
  330.     }
  331.     public function setFileName(string $fileName): void
  332.     {
  333.         $this->fileName $fileName;
  334.     }
  335.     public function getMediaFolderId(): ?string
  336.     {
  337.         return $this->mediaFolderId;
  338.     }
  339.     public function setMediaFolderId(string $mediaFolderId): void
  340.     {
  341.         $this->mediaFolderId $mediaFolderId;
  342.     }
  343.     public function getMediaFolder(): ?MediaFolderEntity
  344.     {
  345.         return $this->mediaFolder;
  346.     }
  347.     public function setMediaFolder(MediaFolderEntity $mediaFolder): void
  348.     {
  349.         $this->mediaFolder $mediaFolder;
  350.     }
  351.     public function getPropertyGroupOptions(): ?PropertyGroupOptionCollection
  352.     {
  353.         return $this->propertyGroupOptions;
  354.     }
  355.     public function setPropertyGroupOptions(PropertyGroupOptionCollection $propertyGroupOptions): void
  356.     {
  357.         $this->propertyGroupOptions $propertyGroupOptions;
  358.     }
  359.     public function getMetaDataRaw(): ?string
  360.     {
  361.         return $this->metaDataRaw;
  362.     }
  363.     public function setMetaDataRaw(string $metaDataRaw): void
  364.     {
  365.         $this->metaDataRaw $metaDataRaw;
  366.     }
  367.     public function getMediaTypeRaw(): ?string
  368.     {
  369.         return $this->mediaTypeRaw;
  370.     }
  371.     public function setMediaTypeRaw(string $mediaTypeRaw): void
  372.     {
  373.         $this->mediaTypeRaw $mediaTypeRaw;
  374.     }
  375.     public function getMailTemplateMedia(): ?MailTemplateMediaCollection
  376.     {
  377.         return $this->mailTemplateMedia;
  378.     }
  379.     public function setMailTemplateMedia(MailTemplateMediaCollection $mailTemplateMedia): void
  380.     {
  381.         $this->mailTemplateMedia $mailTemplateMedia;
  382.     }
  383.     public function getCustomFields(): ?array
  384.     {
  385.         return $this->customFields;
  386.     }
  387.     public function setCustomFields(?array $customFields): void
  388.     {
  389.         $this->customFields $customFields;
  390.     }
  391.     public function getTags(): ?TagCollection
  392.     {
  393.         return $this->tags;
  394.     }
  395.     public function setTags(TagCollection $tags): void
  396.     {
  397.         $this->tags $tags;
  398.     }
  399.     public function getThumbnailsRo(): ?string
  400.     {
  401.         return $this->thumbnailsRo;
  402.     }
  403.     public function setThumbnailsRo(string $thumbnailsRo): void
  404.     {
  405.         $this->thumbnailsRo $thumbnailsRo;
  406.     }
  407.     public function getDocumentBaseConfigs(): ?DocumentBaseConfigCollection
  408.     {
  409.         return $this->documentBaseConfigs;
  410.     }
  411.     public function setDocumentBaseConfigs(DocumentBaseConfigCollection $documentBaseConfigs): void
  412.     {
  413.         $this->documentBaseConfigs $documentBaseConfigs;
  414.     }
  415.     public function getShippingMethods(): ?ShippingMethodCollection
  416.     {
  417.         return $this->shippingMethods;
  418.     }
  419.     public function setShippingMethods(ShippingMethodCollection $shippingMethods): void
  420.     {
  421.         $this->shippingMethods $shippingMethods;
  422.     }
  423.     public function getPaymentMethods(): ?PaymentMethodCollection
  424.     {
  425.         return $this->paymentMethods;
  426.     }
  427.     public function setPaymentMethods(PaymentMethodCollection $paymentMethods): void
  428.     {
  429.         $this->paymentMethods $paymentMethods;
  430.     }
  431.     public function jsonSerialize(): array
  432.     {
  433.         $data parent::jsonSerialize();
  434.         unset($data['metaDataRaw'], $data['mediaTypeRaw']);
  435.         return $data;
  436.     }
  437.     public function getProductConfiguratorSettings(): ?ProductConfiguratorSettingCollection
  438.     {
  439.         return $this->productConfiguratorSettings;
  440.     }
  441.     public function setProductConfiguratorSettings(ProductConfiguratorSettingCollection $productConfiguratorSettings): void
  442.     {
  443.         $this->productConfiguratorSettings $productConfiguratorSettings;
  444.     }
  445.     public function getOrderLineItems(): ?OrderLineItemCollection
  446.     {
  447.         return $this->orderLineItems;
  448.     }
  449.     public function setOrderLineItems(OrderLineItemCollection $orderLineItems): void
  450.     {
  451.         $this->orderLineItems $orderLineItems;
  452.     }
  453.     public function getCmsBlocks(): ?CmsBlockCollection
  454.     {
  455.         return $this->cmsBlocks;
  456.     }
  457.     public function setCmsBlocks(CmsBlockCollection $cmsBlocks): void
  458.     {
  459.         $this->cmsBlocks $cmsBlocks;
  460.     }
  461.     public function getCmsSections(): ?CmsSectionCollection
  462.     {
  463.         return $this->cmsSections;
  464.     }
  465.     public function setCmsSections(CmsSectionCollection $cmsSections): void
  466.     {
  467.         $this->cmsSections $cmsSections;
  468.     }
  469.     public function getCmsPages(): ?CmsBlockCollection
  470.     {
  471.         return $this->cmsPages;
  472.     }
  473.     public function setCmsPages(CmsBlockCollection $cmsPages): void
  474.     {
  475.         $this->cmsPages $cmsPages;
  476.     }
  477.     public function isPrivate(): bool
  478.     {
  479.         return $this->private;
  480.     }
  481.     public function setPrivate(bool $private): void
  482.     {
  483.         $this->private $private;
  484.     }
  485.     public function getDocuments(): ?DocumentCollection
  486.     {
  487.         return $this->documents;
  488.     }
  489.     public function setDocuments(DocumentCollection $documents): void
  490.     {
  491.         $this->documents $documents;
  492.     }
  493. }