src/Entity/MediaObject.php line 73

  1. <?php
  2. // api/src/Entity/MediaObject.php
  3. namespace App\Entity;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use ApiPlatform\Metadata\Post;
  9. use ApiPlatform\Metadata\Put;
  10. use ApiPlatform\Metadata\Delete;
  11. use App\Controller\CreateMediaObjectAction;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Symfony\Component\HttpFoundation\File\File;
  16. use Symfony\Component\Serializer\Annotation\Groups;
  17. use Symfony\Component\Validator\Constraints as Assert;
  18. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  19. use ApiPlatform\Metadata\ApiFilter;
  20. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  21. use Doctrine\DBAL\Types\Types;
  22. use Symfony\Component\Serializer\Annotation\MaxDepth;
  23. #[Vich\Uploadable]
  24. #[ORM\Entity]
  25. #[ApiResource(
  26.     normalizationContext: ['groups' => ['media_object:read']], 
  27.     denormalizationContext: ['groups' => ['media_object:write']],
  28.     types: ['https://schema.org/MediaObject'],
  29.     operations: [
  30.         new Get(),
  31.         new GetCollection(),
  32.         new Delete(),
  33.         new Put(),
  34.         new Post(
  35.             controllerCreateMediaObjectAction::class, 
  36.             deserializefalse
  37.             validationContext: ['groups' => ['Default''media_object_create']], 
  38.             openapiContext: [
  39.                 'requestBody' => [
  40.                     'content' => [
  41.                         'multipart/form-data' => [
  42.                             'schema' => [
  43.                                 'type' => 'object'
  44.                                 'properties' => [
  45.                                     'file' => [
  46.                                         'type' => 'string'
  47.                                         'format' => 'binary'
  48.                                     ]
  49.                                 ]
  50.                             ]
  51.                         ]
  52.                     ]
  53.                 ]
  54.             ]
  55.         )
  56.     ],
  57.     order: ['sort' => 'DESC''id' => 'DESC'],
  58. )]
  59. #[ApiFilter(SearchFilter::class, properties: [
  60.     'product.id' => 'exact'
  61.     'orders.id' => 'exact',
  62.     'orders.account.user.id' => 'exact',
  63. ])]  
  64. #[ORM\HasLifecycleCallbacks]
  65. class MediaObject
  66. {
  67.     #[Groups(['media_object:read''product:read''cat:read',  'user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read','order_product:read','user:read''account:read''load_invoice:read''worker:read''account_worker:read''job:read''site_product:read''news:read''slider:read''gallery:read','gallery_items:read''menu:read''user_docs:read''product_releted:read''materials:read''objects:read''projects:read''posts:read''page:read''pageInfo:read''documents:read'])]
  68.     #[ORM\IdORM\ColumnORM\GeneratedValue]
  69.     private ?int $id null;
  70.     #[ApiProperty(types: ['https://schema.org/contentUrl'])]
  71.     #[Groups(['media_object:read''product:read''cat:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read','order_product:read''user:read''account:read''load_invoice:read''worker:read''account_worker:read''job:read''site_product:read''news:read''slider:read''gallery:read','gallery_items:read''menu:read''user_docs:read''product_releted:read''materials:read''objects:read''projects:read''posts:read''page:read''pageInfo:read''documents:read'])]
  72.     public ?string $contentUrl null;
  73.     
  74.     #[Vich\UploadableField(mapping"media_object"fileNameProperty"filePath")]
  75.     #[Assert\NotNull(groups: ['media_object_create'])]
  76.     public ?File $file null;
  77.     #[Groups(['media_object:read''product:read''cat:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read','order_product:read''user:read''account:read''load_invoice:read''worker:read''account_worker:read''job:read''site_product:read''gallery:read','gallery_items:read''menu:read''projects:read'])]
  78.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  79.     public $uploadTimestamp;
  80.     
  81.     #[Groups(['media_object:read''product:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read','order_product:read','user:read''account:read''load_invoice:read''worker:read''account_worker:read''job:read''cat:read''site_product:read''gallery:read','gallery_items:read''menu:read''projects:read'])]  
  82.     #[ORM\Column(nullabletrue)]
  83.     private ?bool $main null;
  84.     #[ORM\Column(nullabletrue)] 
  85.     #[Groups(['media_object:read''product:read''cat:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read','order_product:read''user:read''account:read''load_invoice:read''worker:read''account_worker:read''job:read''site_product:read''gallery:read','gallery_items:read'])]
  86.     public ?string $filePath null;
  87.     
  88.     #[Groups(['media_object_create'])]
  89.     #[ORM\ManyToOne(inversedBy'media')]
  90.     #[ORM\JoinColumn(name'product_id'referencedColumnName'id'onDelete'SET NULL')]
  91.     private ?Products $product null;
  92.     #[Groups(['media_object_create'])]
  93.     #[ORM\ManyToOne(inversedBy'mediaObjects')]
  94.     private ?Orders $orders null;
  95.     #[Groups(['media_object:read''media_object_create'])]
  96.     #[ORM\Column(length100nullabletrue)]
  97.     private ?string $type null;
  98.     #[Groups(['media_object:read''media_object_create'])]
  99.     #[ORM\Column(length255nullabletrue)]
  100.     private ?string $name null;
  101.     #[Groups(['media_object_create'])]
  102.     #[ORM\ManyToOne(inversedBy'mediaObjects')]
  103.     private ?User $users null;
  104.     #[ORM\OneToMany(mappedBy'media'targetEntityUsersDocs::class)]
  105.     private Collection $usersDocs;
  106.     #[Groups(['media_object_create'])]
  107.     #[ORM\ManyToOne(inversedBy'media')]
  108.     private ?AccountWorker $accountWorker null;
  109.     
  110.     #[Groups(['media_object_create'])]
  111.     #[ORM\ManyToOne(inversedBy'media')]
  112.     private ?FormAnswer $formAnswer null;
  113.     #[Groups(['media_object_create'])]
  114.     #[ORM\ManyToOne(inversedBy'mediaObjects'cascade:['persist'])]
  115.     private ?Jobs $job null;
  116.     #[ORM\OneToMany(mappedBy'photo'targetEntityWorkers::class, cascade:['persist'])]
  117.     private Collection $workers;
  118.     #[ORM\OneToMany(mappedBy'document'targetEntityAccountJobsList::class, cascade:['persist'])]
  119.     private Collection $accountJobsLists;
  120.     #[ORM\OneToMany(mappedBy'commandment'targetEntityJobs::class, cascade:['persist'])]
  121.     private Collection $commandment_jobs;
  122.     #[ORM\OneToMany(mappedBy'graph'targetEntityJobs::class, cascade:['persist'])]
  123.     private Collection $graph_jobs;
  124.     #[ORM\OneToMany(mappedBy'protocole'targetEntityJobs::class, cascade:['persist'])]
  125.     private Collection $protocole_jobs;
  126.     #[ORM\OneToMany(mappedBy'mainMedia'targetEntityProducts::class)]
  127.     private Collection $MainProducts;
  128.     #[Groups(['media_object:read''product:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read','order_product:read','user:read''account:read''load_invoice:read''worker:read''account_worker:read''job:read''site_product:read''cat:read''news:read''product_releted:read''materials:read''objects:read''projects:read''posts:read''page:read''pageInfo:read'])]
  129.     #[ORM\Column(nullabletrue)]
  130.     private ?int $size null;
  131.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'resizeImagings')]
  132.     private ?self $resizeImgParent null;
  133.     #[Groups(['media_object:read''product:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read','order_product:read','user:read''account:read''load_invoice:read''worker:read''account_worker:read''job:read''site_product:read''cat:read''news:read''slider:read''gallery:read','gallery_items:read''user_docs:read''product_releted:read''materials:read''posts:read''objects:read''projects:read''posts:read''page:read''pageInfo:read'])]
  134.     #[ORM\OneToMany(mappedBy'resizeImgParent'targetEntityself::class, cascade:['persist''remove'])]
  135.     private Collection $resizeImagings;
  136.     #[ORM\OneToMany(mappedBy'media'targetEntitySiteProductsMedia::class, cascade:['persist''remove'])]
  137.     private Collection $siteProductsMedia;
  138.  
  139.     #[ORM\OneToMany(mappedBy'media'targetEntityCategory::class, cascade:['persist'])]
  140.     private Collection $categories;
  141.     #[ORM\OneToMany(mappedBy'media'targetEntitySlide::class)]
  142.     private Collection $slides;
  143.     #[ORM\OneToMany(mappedBy'mainMediaHover'targetEntityProducts::class)]
  144.     private Collection $productsHover;
  145.     #[ORM\OneToMany(mappedBy'media'targetEntityNews::class)]
  146.     private Collection $news;
  147.    
  148.     /**
  149.      * @var Collection<int, GalleryItems>
  150.      */
  151.     #[ORM\OneToMany(mappedBy'media'targetEntityGalleryItems::class)]
  152.     private Collection $galleryItems;
  153.     /**
  154.      * @var Collection<int, MenuItems>
  155.      */
  156.     #[ORM\OneToMany(mappedBy'media'targetEntityMenuItems::class)]
  157.     private Collection $menuItems;
  158.     /**
  159.      * @var Collection<int, VacancyRequest>
  160.      */
  161.     #[ORM\OneToMany(mappedBy'media'targetEntityVacancyRequest::class)]
  162.     private Collection $vacancyRequests;
  163.     /**
  164.      * @var Collection<int, MaterialMedia>
  165.      */
  166.     #[ORM\OneToMany(mappedBy'media'targetEntityMaterialMedia::class)]
  167.     private Collection $materialMedia;
  168.     /**
  169.      * @var Collection<int, Accounts>
  170.      */
  171.     #[ORM\OneToMany(mappedBy'media'targetEntityAccounts::class, cascade:['all'])]
  172.     private Collection $accounts;
  173.     /**
  174.      * @var Collection<int, Objects>
  175.      */
  176.     #[ORM\OneToMany(mappedBy'mainMedia'targetEntityObjects::class, cascade:['all'])]
  177.     private Collection $objects;
  178.     /**
  179.      * @var Collection<int, Projects>
  180.      */
  181.     #[ORM\OneToMany(mappedBy'mainMedia'targetEntityProjects::class)]
  182.     private Collection $projects;
  183.     /**
  184.      * @var Collection<int, Posts>
  185.      */
  186.     #[ORM\OneToMany(mappedBy'mainMedia'targetEntityPosts::class)]
  187.     private Collection $posts;
  188.     #[ORM\OneToMany(mappedBy'mobileMedia'targetEntitySlide::class)]
  189.     private Collection $MobileSlides;
  190.     #[Groups(['media_object:read''media_object:write''product:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read','order_product:read','user:read''account:read''load_invoice:read''worker:read''account_worker:read''job:read''site_product:read''cat:read''news:read''product_releted:read'])]
  191.     #[ORM\Column(nullabletrue)]
  192.     private ?int $sort null;
  193.     /**
  194.      * @var Collection<int, Documents>
  195.      */
  196.     #[ORM\OneToMany(mappedBy'media'targetEntityDocuments::class)]
  197.     private Collection $documents;
  198.     public function __construct()
  199.     {
  200.         $this->usersDocs = new ArrayCollection();
  201.         $this->workers = new ArrayCollection();
  202.         $this->accountJobsLists = new ArrayCollection();
  203.         $this->commandment_jobs = new ArrayCollection();
  204.         $this->graph_jobs = new ArrayCollection();
  205.         $this->protocole_jobs = new ArrayCollection();
  206.         $this->MainProducts = new ArrayCollection();
  207.         $this->resizeImagings = new ArrayCollection();
  208.         $this->siteProductsMedia = new ArrayCollection();
  209.         $this->categories = new ArrayCollection();
  210.         $this->slides = new ArrayCollection();
  211.         $this->productsHover = new ArrayCollection();
  212.         $this->news = new ArrayCollection();
  213.         // $this->galleryItems = new ArrayCollection();
  214.         $this->menuItems = new ArrayCollection();
  215.         $this->vacancyRequests = new ArrayCollection();
  216.         $this->materialMedia = new ArrayCollection();
  217.         $this->accounts = new ArrayCollection();
  218.         $this->objects = new ArrayCollection();
  219.         $this->MobileSlides = new ArrayCollection();
  220.         $this->projects = new ArrayCollection();
  221.         $this->posts = new ArrayCollection();
  222.         $this->documents = new ArrayCollection();
  223.     }
  224.     public function getId(): ?int
  225.     
  226.         return $this->id;
  227.     }
  228.     public function getUploadTimestamp(): ?\DateTimeInterface
  229.     {
  230.         return $this->uploadTimestamp;
  231.     }
  232.     public function getProduct(): ?Products
  233.     {
  234.         return $this->product;
  235.     }
  236.     public function setProduct(?Products $product): self
  237.     {
  238.         $this->product $product;
  239.         return $this;
  240.     }
  241.     public function getOrders(): ?Orders
  242.     {
  243.         return $this->orders;
  244.     }
  245.     public function setOrders(?Orders $orders): self
  246.     {
  247.         $this->orders $orders;
  248.         return $this;
  249.     }
  250.     public function getType(): ?string
  251.     {
  252.         return $this->type;
  253.     }
  254.     public function setType(string $type): self
  255.     {
  256.         $this->type $type;
  257.         return $this;
  258.     }
  259.     public function getName(): ?string
  260.     {
  261.         return $this->name;
  262.     }
  263.     public function setName(?string $name): self
  264.     {
  265.         $this->name $name;
  266.         return $this;
  267.     }
  268.     public function getUsers(): ?User
  269.     {
  270.         return $this->users;
  271.     }
  272.     public function setUsers(?User $users): self
  273.     {
  274.         $this->users $users;
  275.         return $this;
  276.     }
  277.     public function getAccountWorker(): ?AccountWorker
  278.     {
  279.         return $this->accountWorker;
  280.     }
  281.     public function setAccountWorker(?AccountWorker $accountWorker): self
  282.     {
  283.         $this->accountWorker $accountWorker;
  284.         return $this;
  285.     }
  286.     
  287.     public function setFormAnswer(?FormAnswer $formAnswer): self
  288.     {
  289.         $this->formAnswer $formAnswer;
  290.         return $this;
  291.     }
  292.     /**
  293.      * @return Collection<int, UsersDocs>
  294.      */
  295.     public function getUsersDocs(): Collection
  296.     {
  297.         return $this->usersDocs;
  298.     }
  299.     public function addUsersDoc(UsersDocs $usersDoc): static
  300.     {
  301.         if (!$this->usersDocs->contains($usersDoc)) {
  302.             $this->usersDocs->add($usersDoc);
  303.             $usersDoc->setMedia($this);
  304.         }
  305.         return $this;
  306.     }
  307.     
  308.     public function getJob(): ?Jobs
  309.     {
  310.         return $this->job;
  311.     }
  312.     public function setJob(?Jobs $job): self
  313.     {
  314.         $this->job $job;
  315.         return $this;
  316.     }
  317.     /**
  318.      * @return Collection<int, Workers>
  319.      */
  320.     public function getWorkers(): Collection
  321.     {
  322.         return $this->workers;
  323.     }
  324.     public function addWorker(Workers $worker): self
  325.     {
  326.         if (!$this->workers->contains($worker)) {
  327.             $this->workers->add($worker);
  328.             $worker->setPhoto($this);
  329.         }
  330.         return $this;
  331.     }
  332.     public function removeUsersDoc(UsersDocs $usersDoc): static
  333.     {
  334.         if ($this->usersDocs->removeElement($usersDoc)) {
  335.             // set the owning side to null (unless already changed)
  336.             if ($usersDoc->getMedia() === $this) {
  337.                 $usersDoc->setMedia(null);
  338.             }
  339.         }
  340.         return $this;
  341.     }
  342.     public function removeWorker(Workers $worker): self
  343.     {
  344.         if ($this->workers->removeElement($worker)) {
  345.             // set the owning side to null (unless already changed)
  346.             if ($worker->getPhoto() === $this) {
  347.                 $worker->setPhoto(null);
  348.             }
  349.         }
  350.         return $this;
  351.     }
  352.     /**
  353.      * @return Collection<int, AccountJobsList>
  354.      */
  355.     public function getAccountJobsLists(): Collection
  356.     {
  357.         return $this->accountJobsLists;
  358.     }
  359.     public function addAccountJobsList(AccountJobsList $accountJobsList): self
  360.     {
  361.         if (!$this->accountJobsLists->contains($accountJobsList)) {
  362.             $this->accountJobsLists->add($accountJobsList);
  363.             $accountJobsList->setDocument($this);
  364.         }
  365.         return $this;
  366.     }
  367.     public function removeAccountJobsList(AccountJobsList $accountJobsList): self
  368.     {
  369.         if ($this->accountJobsLists->removeElement($accountJobsList)) {
  370.             // set the owning side to null (unless already changed)
  371.             if ($accountJobsList->getDocument() === $this) {
  372.                 $accountJobsList->setDocument(null);
  373.             }
  374.         }
  375.         return $this;
  376.     }
  377.     /**
  378.      * @return Collection<int, Jobs>
  379.      */
  380.     public function getCommandmentJobs(): Collection
  381.     {
  382.         return $this->commandment_jobs;
  383.     }
  384.     public function addCommandmentJob(Jobs $commandmentJob): self
  385.     {
  386.         if (!$this->commandment_jobs->contains($commandmentJob)) {
  387.             $this->commandment_jobs->add($commandmentJob);
  388.             $commandmentJob->setCommandment($this);
  389.         }
  390.         return $this;
  391.     }
  392.     public function removeCommandmentJob(Jobs $commandmentJob): self
  393.     {
  394.         if ($this->commandment_jobs->removeElement($commandmentJob)) {
  395.             // set the owning side to null (unless already changed)
  396.             if ($commandmentJob->getCommandment() === $this) {
  397.                 $commandmentJob->setCommandment(null);
  398.             }
  399.         }
  400.         return $this;
  401.     }
  402.     /**
  403.      * @return Collection<int, Jobs>
  404.      */
  405.     public function getGraphJobs(): Collection
  406.     {
  407.         return $this->graph_jobs;
  408.     }
  409.     public function addGraphJob(Jobs $graphJob): self
  410.     {
  411.         if (!$this->graph_jobs->contains($graphJob)) {
  412.             $this->graph_jobs->add($graphJob);
  413.             $graphJob->setGraph($this);
  414.         }
  415.         return $this;
  416.     }
  417.     public function removeGraphJob(Jobs $graphJob): self
  418.     {
  419.         if ($this->graph_jobs->removeElement($graphJob)) {
  420.             // set the owning side to null (unless already changed)
  421.             if ($graphJob->getGraph() === $this) {
  422.                 $graphJob->setGraph(null);
  423.             }
  424.         }
  425.         return $this;
  426.     }
  427.     /**
  428.      * @return Collection<int, Jobs>
  429.      */
  430.     public function getProtocoleJobs(): Collection
  431.     {
  432.         return $this->protocole_jobs;
  433.     }
  434.     public function addProtocoleJob(Jobs $protocoleJob): self
  435.     {
  436.         if (!$this->protocole_jobs->contains($protocoleJob)) {
  437.             $this->protocole_jobs->add($protocoleJob);
  438.             $protocoleJob->setProtocole($this);
  439.         }
  440.         return $this;
  441.     }
  442.     public function removeProtocoleJob(Jobs $protocoleJob): self
  443.     {
  444.         if ($this->protocole_jobs->removeElement($protocoleJob)) {
  445.             // set the owning side to null (unless already changed)
  446.             if ($protocoleJob->getProtocole() === $this) {
  447.                 $protocoleJob->setProtocole(null);
  448.             }
  449.         }
  450.         return $this;
  451.     }
  452.     public function isMain(): ?bool
  453.     {
  454.         return $this->main;
  455.     }
  456.     public function setMain(?bool $main): self
  457.     {
  458.         $this->main $main;
  459.         return $this;
  460.     }
  461.     /**
  462.      * @return Collection<int, Products>
  463.      */
  464.     public function getMainProducts(): Collection
  465.     {
  466.         return $this->MainProducts;
  467.     }
  468.     public function addMainProduct(Products $mainProduct): self
  469.     {
  470.         if (!$this->MainProducts->contains($mainProduct)) {
  471.             $this->MainProducts->add($mainProduct);
  472.             $mainProduct->setMainMedia($this);
  473.         }
  474.         return $this;
  475.     }
  476.     public function removeMainProduct(Products $mainProduct): self
  477.     {
  478.         if ($this->MainProducts->removeElement($mainProduct)) {
  479.             // set the owning side to null (unless already changed)
  480.             if ($mainProduct->getMainMedia() === $this) {
  481.                 $mainProduct->setMainMedia(null);
  482.             }
  483.         }
  484.         return $this;
  485.     }
  486.     #[ORM\PrePersist]
  487.     public function setCreatedAtValue(): void
  488.     {
  489.         $this->uploadTimestamp = new \DateTime(); 
  490.     }
  491.     public function getSize(): ?int
  492.     {
  493.         return $this->size;
  494.     }
  495.     public function setSize(?int $size): static
  496.     {
  497.         $this->size $size;
  498.         return $this;
  499.     }
  500.     public function getResizeImgParent(): ?self
  501.     {
  502.         return $this->resizeImgParent;
  503.     }
  504.     public function setResizeImgParent(?self $resizeImgParent): static
  505.     {
  506.         $this->resizeImgParent $resizeImgParent;
  507.         return $this;
  508.     }
  509.     /**
  510.      * @return Collection<int, self>
  511.      */
  512.     public function getResizeImagings(): Collection
  513.     {
  514.         return $this->resizeImagings;
  515.     }
  516.     public function addResizeImging(self $resizeImging): static
  517.     {
  518.         if (!$this->resizeImagings->contains($resizeImging)) {
  519.             $this->resizeImagings->add($resizeImging);
  520.             $resizeImging->setResizeImgParent($this);
  521.         }
  522.         return $this;
  523.     }
  524.     public function removeResizeImging(self $resizeImging): static
  525.     {
  526.         if ($this->resizeImagings->removeElement($resizeImging)) {
  527.             // set the owning side to null (unless already changed)
  528.             if ($resizeImging->getResizeImgParent() === $this) {
  529.                 $resizeImging->setResizeImgParent(null);
  530.             }
  531.         }
  532.         return $this;
  533.     }
  534.     /**
  535.      * @return Collection<int, SiteProductsMedia>
  536.      */
  537.     public function getSiteProductsMedia(): Collection
  538.     {
  539.         return $this->siteProductsMedia;
  540.     }
  541.     public function addSiteProductsMedium(SiteProductsMedia $siteProductsMedium): static
  542.     {
  543.         if (!$this->siteProductsMedia->contains($siteProductsMedium)) {
  544.             $this->siteProductsMedia->add($siteProductsMedium);
  545.             $siteProductsMedium->setMedia($this);
  546.         }
  547.         return $this;
  548.     }
  549.     public function removeSiteProductsMedium(SiteProductsMedia $siteProductsMedium): static
  550.     {
  551.         if ($this->siteProductsMedia->removeElement($siteProductsMedium)) {
  552.             // set the owning side to null (unless already changed)
  553.             if ($siteProductsMedium->getMedia() === $this) {
  554.                 $siteProductsMedium->setMedia(null);
  555.             }
  556.         }
  557.         return $this;
  558.     }
  559.     /**
  560.      * @return Collection<int, Category>
  561.      */
  562.     public function getCategories(): Collection
  563.     {
  564.         return $this->categories;
  565.     }
  566.     public function addCategory(Category $category): static
  567.     {
  568.         if (!$this->categories->contains($category)) {
  569.             $this->categories->add($category);
  570.             $category->setMedia($this);
  571.         }
  572.         return $this;
  573.     }
  574.     public function removeCategory(Category $category): static
  575.     {
  576.         if ($this->categories->removeElement($category)) {
  577.             // set the owning side to null (unless already changed)
  578.             if ($category->getMedia() === $this) {
  579.                 $category->setMedia(null);
  580.             }
  581.         }
  582.         return $this;
  583.     }
  584.     /**
  585.      * @return Collection<int, Slide>
  586.      */
  587.     public function getSlides(): Collection
  588.     {
  589.         return $this->slides;
  590.     }
  591.     public function addSlide(Slide $slide): static
  592.     {
  593.         if (!$this->slides->contains($slide)) {
  594.             $this->slides->add($slide);
  595.             $slide->setMedia($this);
  596.         }
  597.         return $this;
  598.     }
  599.     public function removeSlide(Slide $slide): static
  600.     {
  601.         if ($this->slides->removeElement($slide)) {
  602.             // set the owning side to null (unless already changed)
  603.             if ($slide->getMedia() === $this) {
  604.                 $slide->setMedia(null);
  605.             }
  606.         }
  607.         return $this;
  608.     }
  609.     /**
  610.      * @return Collection<int, Products>
  611.      */
  612.     public function getProductsHover(): Collection
  613.     {
  614.         return $this->productsHover;
  615.     }
  616.     public function addProductsHover(Products $productsHover): static
  617.     {
  618.         if (!$this->productsHover->contains($productsHover)) {
  619.             $this->productsHover->add($productsHover);
  620.             $productsHover->setMainMediaHover($this);
  621.         }
  622.         return $this;
  623.     }
  624.     public function removeProductsHover(Products $productsHover): static
  625.     {
  626.         if ($this->productsHover->removeElement($productsHover)) {
  627.             // set the owning side to null (unless already changed)
  628.             if ($productsHover->getMainMediaHover() === $this) {
  629.                 $productsHover->setMainMediaHover(null);
  630.             }
  631.         }
  632.         return $this;
  633.     }
  634.     /**
  635.      * @return Collection<int, News>
  636.      */
  637.     public function getNews(): Collection
  638.     {
  639.         return $this->news;
  640.     }
  641.     public function addNews(News $news): static
  642.     {
  643.         if (!$this->news->contains($news)) {
  644.             $this->news->add($news);
  645.             $news->setMedia($this);
  646.         }
  647.         return $this;
  648.     }
  649.     public function removeNews(News $news): static
  650.     {
  651.         if ($this->news->removeElement($news)) {
  652.             // set the owning side to null (unless already changed)
  653.             if ($news->getMedia() === $this) {
  654.                 $news->setMedia(null);
  655.             }
  656.         }
  657.         return $this;
  658.     }
  659.     /**
  660.      * @return Collection<int, GalleryItems>
  661.      */
  662.     public function getGalleryItems(): Collection
  663.     {
  664.         return $this->galleryItems;
  665.     }
  666.     public function addGalleryItem(GalleryItems $galleryItem): static
  667.     {
  668.         if (!$this->galleryItems->contains($galleryItem)) {
  669.             $this->galleryItems->add($galleryItem);
  670.             $galleryItem->setMedia($this);
  671.         }
  672.         return $this;
  673.     }
  674.     public function removeGalleryItem(GalleryItems $galleryItem): static
  675.     {
  676.         if ($this->galleryItems->removeElement($galleryItem)) {
  677.             // set the owning side to null (unless already changed)
  678.             if ($galleryItem->getMedia() === $this) {
  679.                 $galleryItem->setMedia(null);
  680.             }
  681.         }
  682.         return $this;
  683.     }
  684.     /**
  685.      * @return Collection<int, MenuItems>
  686.      */
  687.     public function getMenuItems(): Collection
  688.     {
  689.         return $this->menuItems;
  690.     }
  691.     public function addMenuItem(MenuItems $menuItem): static
  692.     {
  693.         if (!$this->menuItems->contains($menuItem)) {
  694.             $this->menuItems->add($menuItem);
  695.             $menuItem->setMedia($this);
  696.         }
  697.         return $this;
  698.     }
  699.     public function removeMenuItem(MenuItems $menuItem): static
  700.     {
  701.         if ($this->menuItems->removeElement($menuItem)) {
  702.             // set the owning side to null (unless already changed)
  703.             if ($menuItem->getMedia() === $this) {
  704.                 $menuItem->setMedia(null);
  705.             }
  706.         }
  707.         return $this;
  708.     }
  709.     /**
  710.      * @return Collection<int, VacancyRequest>
  711.      */
  712.     public function getVacancyRequests(): Collection
  713.     {
  714.         return $this->vacancyRequests;
  715.     }
  716.     public function addVacancyRequest(VacancyRequest $vacancyRequest): static
  717.     {
  718.         if (!$this->vacancyRequests->contains($vacancyRequest)) {
  719.             $this->vacancyRequests->add($vacancyRequest);
  720.             $vacancyRequest->setMedia($this);
  721.         }
  722.         return $this;
  723.     }
  724.     public function removeVacancyRequest(VacancyRequest $vacancyRequest): static
  725.     {
  726.         if ($this->vacancyRequests->removeElement($vacancyRequest)) {
  727.             // set the owning side to null (unless already changed)
  728.             if ($vacancyRequest->getMedia() === $this) {
  729.                 $vacancyRequest->setMedia(null);
  730.             }
  731.         }
  732.         return $this;
  733.     }
  734.     /**
  735.      * @return Collection<int, MaterialMedia>
  736.      */
  737.     public function getMaterialMedia(): Collection
  738.     {
  739.         return $this->materialMedia;
  740.     }
  741.     public function addMaterialMedium(MaterialMedia $materialMedium): static
  742.     {
  743.         if (!$this->materialMedia->contains($materialMedium)) {
  744.             $this->materialMedia->add($materialMedium);
  745.             $materialMedium->setMedia($this);
  746.         }
  747.         return $this;
  748.     }
  749.     public function removeMaterialMedium(MaterialMedia $materialMedium): static
  750.     {
  751.         if ($this->materialMedia->removeElement($materialMedium)) {
  752.             // set the owning side to null (unless already changed)
  753.             if ($materialMedium->getMedia() === $this) {
  754.                 $materialMedium->setMedia(null);
  755.             }
  756.         }
  757.         return $this;
  758.     }
  759.     /**
  760.      * @return Collection<int, Accounts>
  761.      */
  762.     public function getAccounts(): Collection
  763.     {
  764.         return $this->accounts;
  765.     }
  766.     public function addAccount(Accounts $account): static
  767.     {
  768.         if (!$this->accounts->contains($account)) {
  769.             $this->accounts->add($account);
  770.             $account->setMedia($this);
  771.         }
  772.         return $this;
  773.     }
  774.     public function removeAccount(Accounts $account): static
  775.     {
  776.         if ($this->accounts->removeElement($account)) {
  777.             // set the owning side to null (unless already changed)
  778.             if ($account->getMedia() === $this) {
  779.                 $account->setMedia(null);
  780.             }
  781.         }
  782.         return $this;
  783.     }
  784.     /**
  785.      * @return Collection<int, Objects>
  786.      */
  787.     public function getObjects(): Collection
  788.     {
  789.         return $this->objects;
  790.     }
  791.     public function addObject(Objects $object): static
  792.     {
  793.         if (!$this->objects->contains($object)) {
  794.             $this->objects->add($object);
  795.             $object->setMainMedia($this);
  796.         }
  797.         return $this;
  798.     }
  799.     public function removeObject(Objects $object): static
  800.     {
  801.         if ($this->objects->removeElement($object)) {
  802.             // set the owning side to null (unless already changed)
  803.             if ($object->getMainMedia() === $this) {
  804.                 $object->setMainMedia(null);
  805.             }
  806.         }
  807.         return $this;
  808.     }
  809.     /**
  810.      * @return Collection<int, Slide>
  811.      */
  812.     public function getMobileSlides(): Collection
  813.     {
  814.         return $this->MobileSlides;
  815.     }
  816.     public function addMobileSlide(Slide $mobileSlide): static
  817.     {
  818.         if (!$this->MobileSlides->contains($mobileSlide)) {
  819.             $this->MobileSlides->add($mobileSlide);
  820.             $mobileSlide->setMobileMedia($this);
  821.         }
  822.         return $this;
  823.     }
  824.     
  825.     /**
  826.      * @return Collection<int, Projects>
  827.      */
  828.     public function getProjects(): Collection
  829.     {
  830.         return $this->projects;
  831.     }
  832.     public function addProject(Projects $project): static
  833.     {
  834.         if (!$this->projects->contains($project)) {
  835.             $this->projects->add($project);
  836.             $project->setMainMedia($this);
  837.         }
  838.         return $this;
  839.     }
  840.     public function removeMobileSlide(Slide $mobileSlide): static
  841.     {
  842.         if ($this->MobileSlides->removeElement($mobileSlide)) {
  843.             // set the owning side to null (unless already changed)
  844.             if ($mobileSlide->getMobileMedia() === $this) {
  845.                 $mobileSlide->setMobileMedia(null);
  846.             }
  847.             return $this;
  848.         }
  849.     }
  850.     public function removeProject(Projects $project): static
  851.     {
  852.         if ($this->projects->removeElement($project)) {
  853.             // set the owning side to null (unless already changed)
  854.             if ($project->getMainMedia() === $this) {
  855.                 $project->setMainMedia(null);
  856.             }
  857.         }
  858.         return $this;
  859.     }
  860.     public function getSort(): ?int
  861.     {
  862.         return $this->sort;
  863.     }
  864.     public function setSort(?int $sort): static
  865.     {
  866.         $this->sort $sort;
  867.         return $this;
  868.     }
  869.     /**
  870.      * @return Collection<int, Posts>
  871.      */
  872.     public function getPosts(): Collection
  873.     {
  874.         return $this->posts;
  875.     }
  876.     public function addPost(Posts $post): static
  877.     {
  878.         if (!$this->posts->contains($post)) {
  879.             $this->posts->add($post);
  880.             $post->setMainMedia($this);
  881.         }
  882.         return $this;
  883.     }
  884.     public function removePost(Posts $post): static
  885.     {
  886.         if ($this->posts->removeElement($post)) {
  887.             // set the owning side to null (unless already changed)
  888.             if ($post->getMainMedia() === $this) {
  889.                 $post->setMainMedia(null);
  890.             }
  891.         }
  892.         return $this;
  893.     }
  894.     /**
  895.      * @return Collection<int, Documents>
  896.      */
  897.     public function getDocuments(): Collection
  898.     {
  899.         return $this->documents;
  900.     }
  901.     public function addDocument(Documents $document): static
  902.     {
  903.         if (!$this->documents->contains($document)) {
  904.             $this->documents->add($document);
  905.             $document->setMedia($this);
  906.         }
  907.         return $this;
  908.     }
  909.     public function removeDocument(Documents $document): static
  910.     {
  911.         if ($this->documents->removeElement($document)) {
  912.             // set the owning side to null (unless already changed)
  913.             if ($document->getMedia() === $this) {
  914.                 $document->setMedia(null);
  915.             }
  916.         }
  917.         return $this;
  918.     }
  919. }