src/Entity/Media/ShareCart.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Media;
  3. use App\Entity\Media\Document;
  4. use App\Entity\Site\AccessSite;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11.  * @ORM\Entity(repositoryClass="App\Repository\Media\ShareCartRepository")
  12.  * @ORM\Table(name="shares_carts")
  13.  * @ORM\HasLifecycleCallbacks
  14.  */ 
  15. class ShareCart
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\Column(type="integer")
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     private $id;
  23.     
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity="App\Entity\Site\AccessSite", inversedBy="shareCarts")
  26.      */
  27.     private $accessSite;
  28.     
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=false)
  31.      * @Assert\NotBlank()
  32.      */
  33.     private $name;
  34.     
  35.     /**
  36.      * @ORM\Column(type="string", length=255, nullable=false)
  37.      * @Assert\NotBlank()
  38.      */
  39.     private $token;
  40.     
  41.     /**
  42.      * @ORM\Column(type="text", nullable=true)
  43.      */
  44.     private $comment;
  45.     
  46.     /**
  47.      * @ORM\ManyToMany(targetEntity="App\Entity\Media\Document")
  48.      */
  49.     private $documents;
  50.     
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity="App\Entity\Media\Quality", inversedBy="documents")
  53.      * @ORM\JoinColumn(name="quality_id", referencedColumnName="id")
  54.      */
  55.     private $quality;
  56.     
  57.     /**
  58.      * @ORM\Column(type="array", nullable=true, name="recipients")
  59.      */
  60.     private $recipients;
  61.     
  62.     /**
  63.      * @ORM\Column(type="datetime", nullable=false, name="expiration_date")
  64.      * @Assert\NotBlank()
  65.      */
  66.     private $expirationDate;
  67.     
  68.     /**
  69.      * @ORM\Column(type="integer", nullable=false, name="copyright_type")
  70.      * @Assert\NotBlank()
  71.      */
  72.     private $copyrightType 0;
  73.     
  74.     /**
  75.      * @ORM\Column(type="integer", nullable=false, name="flicker_share")
  76.      * @Assert\NotBlank()
  77.      */
  78.     private $flickerShare 0;
  79.     
  80.     /**
  81.      * @ORM\Column(type="array", nullable=true, name="flicker_album")
  82.      */
  83.     private $flickerAlbum;
  84.     /**
  85.      * @ORM\Column(type="datetime", nullable=false, name="created_date")
  86.      * @Gedmo\Timestampable(on="create")
  87.      */
  88.     private $createdDate;
  89.     /**
  90.      * @ORM\Column(type="datetime", nullable=true, name="updated_date")
  91.      * @Gedmo\Timestampable(on="update")
  92.      */
  93.     private $updatedDate;
  94.     /**
  95.      * @ORM\Column(type="integer", nullable=true, name="status")
  96.      */
  97.     private $status 1;
  98.     
  99.        
  100.     public function __construct()
  101.     {
  102.         $this->documents = new ArrayCollection();
  103.         
  104.         $expirationDate = new \DateTime();
  105.         $expirationDate->modify("+1 month");
  106.         $this->setExpirationDate($expirationDate);
  107.         
  108.         if(!$this->getId())
  109.             $this->setToken(bin2hex(random_bytes(15)));
  110.     }
  111.     public function getId(): ?int
  112.     {
  113.         return $this->id;
  114.     }
  115.     
  116.     public function getName(): ?string
  117.     {
  118.         return $this->name;
  119.     }
  120.     
  121.     public function setName(string $name): self
  122.     {
  123.         $this->name $name;
  124.         
  125.         return $this;
  126.     }
  127.     
  128.     public function getToken(): ?string
  129.     {
  130.         return $this->token;
  131.     }
  132.     
  133.     public function setToken(string $token): self
  134.     {
  135.         $this->token $token;
  136.         
  137.         return $this;
  138.     }
  139.     
  140.     public function getComment(): ?string
  141.     {
  142.         return $this->comment;
  143.     }
  144.     
  145.     public function setComment(string $comment): self
  146.     {
  147.         $this->comment $comment;
  148.         
  149.         return $this;
  150.     }
  151.     
  152.     public function getAccessSite(): ?AccessSite
  153.     {
  154.         return $this->accessSite;
  155.     }
  156.     
  157.     public function setAccessSite(AccessSite $accessSite): self
  158.     {
  159.         $this->accessSite $accessSite;
  160.         
  161.         return $this;
  162.     }
  163.     
  164.     public function getExpirationDate(): ?\DateTimeInterface
  165.     {
  166.         return $this->expirationDate;
  167.     }
  168.     
  169.     public function setExpirationDate(\DateTimeInterface $expirationDate null): self
  170.     {
  171.         $this->expirationDate $expirationDate;
  172.         
  173.         return $this;
  174.     }
  175.     
  176.     public function getUpdatedDate(): ?\DateTimeInterface
  177.     {
  178.         return $this->updatedDate;
  179.     }
  180.     public function getCreatedDate(): ?\DateTimeInterface
  181.     {
  182.         return $this->createdDate;
  183.     }
  184.        
  185.     public function getStatus(): ?int
  186.     {
  187.         return $this->status;
  188.     }
  189.     public function setStatus(?int $status): self
  190.     {
  191.         $this->status $status;
  192.         return $this;
  193.     }
  194.     
  195.     public function getCopyrightType(): ?int
  196.     {
  197.         return $this->copyrightType;
  198.     }
  199.     
  200.     public function setCopyrightType(?int $copyrightType): self
  201.     {
  202.         $this->copyrightType $copyrightType;
  203.         
  204.         return $this;
  205.     }
  206.     
  207.     public function getFlickerShare(): ?int
  208.     {
  209.         return $this->flickerShare;
  210.     }
  211.     
  212.     public function setFlickerShare(?int $flickerShare): self
  213.     {
  214.         $this->flickerShare $flickerShare;
  215.         
  216.         return $this;
  217.     }
  218.         
  219.     /**
  220.      * @return Collection|Document[]
  221.      */
  222.     public function getDocuments(): Collection
  223.     {
  224.         return $this->documents;
  225.     }
  226.     
  227.     public function addDocument(Document $document): self
  228.     {
  229.         if (!$this->documents->contains($document)) {
  230.             $this->documents[] = $document;
  231.         }
  232.         
  233.         return $this;
  234.     }
  235.     
  236.     public function removeDocument(Document $document): self
  237.     {
  238.         if ($this->documents->contains($document)) {
  239.             $this->documents->removeElement($document);
  240.         }
  241.         
  242.         return $this;
  243.     }
  244.     
  245.     public function getQuality(): ?Quality
  246.     {
  247.         return $this->quality;
  248.     }
  249.     
  250.     public function setQuality(?Quality $quality): self
  251.     {
  252.         $this->quality $quality;
  253.         
  254.         return $this;
  255.     }
  256.     
  257.     public function getFlickerAlbum(): ?array
  258.     {
  259.         return $this->flickerAlbum;
  260.     }
  261.     
  262.     public function setFlickerAlbum(?array $flickerAlbum): self
  263.     {
  264.         $this->flickerAlbum $flickerAlbum;
  265.         
  266.         return $this;
  267.     }
  268.     public function getRecipients(): ?array
  269.     {
  270.         return $this->recipients;
  271.     }
  272.     public function setRecipients(?array $recipients): self
  273.     {
  274.         $this->recipients $recipients;
  275.         return $this;
  276.     }
  277. }