src/Entity/Project.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ProjectRepository::class)
  10.  */
  11. class Project
  12. {
  13.     const PROJECT_PUBLISHED 1;
  14.     const PROJECT_NOT_PUBLISHED 0;
  15.     const STATUS_RECEIVED 'received';
  16.     const STATUS_NOMINATED 'nominated';
  17.     const STATUS_WINNER 'winner';
  18.     const TEAM_HERO 'hero';
  19.     const TEAM_MINI_HERO 'mini-hero';
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      *
  29.      * @Assert\NotBlank(message="Veuillez donner un titre à votre projet")
  30.      */
  31.     private $title;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      *
  35.      * @Assert\NotBlank(message="Veuillez renseigner le nom de votre structure")
  36.      */
  37.     private $name;
  38.     /**
  39.      * @ORM\Column(type="text", nullable=true)
  40.      *
  41.      * @Assert\NotBlank(message="Veuillez renseigner le texte en cas de victoire")
  42.      */
  43.     private $text;
  44.     /**
  45.      * @ORM\Column(type="string", length=255, nullable=true)
  46.      */
  47.     private $video;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=ProjectCategory::class, inversedBy="projects")
  50.      *
  51.      * @Assert\NotBlank(message="Veuillez choisir une catégorie")
  52.      */
  53.     private $category;
  54.     /**
  55.      * @ORM\Column(type="date", nullable=true)
  56.      */
  57.     private $sendAt;
  58.     /**
  59.      * @ORM\Column(type="integer", nullable=true)
  60.      *
  61.      * @Assert\NotBlank(message="Veuillez renseigner le nom de votre structure")
  62.      */
  63.     private $year;
  64.     /**
  65.      * @ORM\Column(type="string", length=255, nullable=true)
  66.      *
  67.      * @Assert\NotBlank(message="Veuillez renseigner le numéro et nom de la rue")
  68.      */
  69.     private $address;
  70.     /**
  71.      * @ORM\Column(type="string", length=255, nullable=true)
  72.      *
  73.      * @Assert\NotBlank(message="Veuillez renseigner votre commune")
  74.      */
  75.     private $city;
  76.     /**
  77.      * @ORM\Column(type="string", length=255, nullable=true)
  78.      *
  79.      * @Assert\NotBlank(message="Veuillez renseigner votre code postal")
  80.      */
  81.     private $zipCode;
  82.     /**
  83.      * @ORM\Column(type="string", length=255, nullable=true)
  84.      *
  85.      * @Assert\NotBlank(message="Veuillez renseigner votre prénom")
  86.      */
  87.     private $firstname;
  88.     /**
  89.      * @ORM\Column(type="string", length=255, nullable=true)
  90.      *
  91.      * @Assert\NotBlank(message="Veuillez renseigner votre nom de famille")
  92.      */
  93.     private $lastname;
  94.     /**
  95.      * @ORM\Column(type="string", length=255, nullable=true)
  96.      *
  97.      * @Assert\NotBlank(message="Veuillez renseigner votre adresse mail")
  98.      * @Assert\Email(message="Veuillez renseigner une adresse mail valide")
  99.      */
  100.     private $email;
  101.     /**
  102.      * @ORM\Column(type="string", length=255, nullable=true)
  103.      *
  104.      * @Assert\NotBlank(message="Veuillez renseigner votre numéro de téléphone")
  105.      */
  106.     private $phone;
  107.     /**
  108.      * @ORM\Column(type="string", length=255, nullable=true)
  109.      *
  110.      * @Assert\NotBlank(message="Veuillez choisir votre équipe")
  111.      */
  112.     private $team;
  113.     /**
  114.      * @ORM\Column(type="string", length=255)
  115.      */
  116.     private $status;
  117.     /**
  118.      * @ORM\Column(type="date", nullable=true)
  119.      *
  120.      * @Assert\NotBlank(message="Veuillez sélectionner la date de fin de projet")
  121.      */
  122.     private $makeAt;
  123.     /**
  124.      * @ORM\Column(type="boolean", nullable=true)
  125.      *
  126.      * @Assert\IsTrue(message="Vous devez confirmer les droits d'auteur")
  127.      */
  128.     private $hasCopyright;
  129.     /**
  130.      * @ORM\Column(type="string", length=255, nullable=true)
  131.      */
  132.     private $thumbnail;
  133.     /**
  134.      * @ORM\OneToMany(targetEntity=ProjectImages::class, mappedBy="project")
  135.      */
  136.     private $projectImages;
  137.     /**
  138.      * @ORM\Column(type="boolean", nullable=true)
  139.      */
  140.     private $isPublished;
  141.     /**
  142.      * @ORM\Column(type="text", nullable=true)
  143.      *
  144.      * @Assert\NotBlank(message="Veuillez ajouter une description du projet")
  145.      */
  146.     private $description;
  147.     public function __construct()
  148.     {
  149.         $this->sendAt = new \DateTime();
  150.         $this->projectImages = new ArrayCollection();
  151.         $this->isPublished false;
  152.         $this->status self::STATUS_RECEIVED;
  153.         $this->year date('Y');
  154.     }
  155.     public function getId(): ?int
  156.     {
  157.         return $this->id;
  158.     }
  159.     public function getTitle(): ?string
  160.     {
  161.         return $this->title;
  162.     }
  163.     public function setTitle(?string $title): self
  164.     {
  165.         $this->title $title;
  166.         return $this;
  167.     }
  168.     public function getName(): ?string
  169.     {
  170.         return $this->name;
  171.     }
  172.     public function setName(?string $name): self
  173.     {
  174.         $this->name $name;
  175.         return $this;
  176.     }
  177.     public function getText(): ?string
  178.     {
  179.         return $this->text;
  180.     }
  181.     public function setText(?string $text): self
  182.     {
  183.         $this->text $text;
  184.         return $this;
  185.     }
  186.     public function getVideo()
  187.     {
  188.         return $this->video;
  189.     }
  190.     public function setVideo($video)
  191.     {
  192.         $this->video $video;
  193.         return $this;
  194.     }
  195.     public function getCategory(): ?ProjectCategory
  196.     {
  197.         return $this->category;
  198.     }
  199.     public function setCategory(?ProjectCategory $category): self
  200.     {
  201.         $this->category $category;
  202.         return $this;
  203.     }
  204.     public function getSendAt(): ?\DateTimeInterface
  205.     {
  206.         return $this->sendAt;
  207.     }
  208.     public function setSendAt(?\DateTimeInterface $sendAt): self
  209.     {
  210.         $this->sendAt $sendAt;
  211.         return $this;
  212.     }
  213.     public function getYear(): ?int
  214.     {
  215.         return $this->year;
  216.     }
  217.     public function setYear(?int $year): self
  218.     {
  219.         $this->year $year;
  220.         return $this;
  221.     }
  222.     public function getAddress(): ?string
  223.     {
  224.         return $this->address;
  225.     }
  226.     public function setAddress(?string $address): self
  227.     {
  228.         $this->address $address;
  229.         return $this;
  230.     }
  231.     public function getCity(): ?string
  232.     {
  233.         return $this->city;
  234.     }
  235.     public function setCity(?string $city): self
  236.     {
  237.         $this->city $city;
  238.         return $this;
  239.     }
  240.     public function getZipCode(): ?string
  241.     {
  242.         return $this->zipCode;
  243.     }
  244.     public function setZipCode(?string $zipCode): self
  245.     {
  246.         $this->zipCode $zipCode;
  247.         return $this;
  248.     }
  249.     public function getFirstname(): ?string
  250.     {
  251.         return $this->firstname;
  252.     }
  253.     public function setFirstname(?string $firstname): self
  254.     {
  255.         $this->firstname $firstname;
  256.         return $this;
  257.     }
  258.     public function getLastname(): ?string
  259.     {
  260.         return $this->lastname;
  261.     }
  262.     public function setLastname(?string $lastname): self
  263.     {
  264.         $this->lastname $lastname;
  265.         return $this;
  266.     }
  267.     public function getEmail(): ?string
  268.     {
  269.         return $this->email;
  270.     }
  271.     public function setEmail(?string $email): self
  272.     {
  273.         $this->email $email;
  274.         return $this;
  275.     }
  276.     public function getPhone(): ?string
  277.     {
  278.         return $this->phone;
  279.     }
  280.     public function setPhone(?string $phone): self
  281.     {
  282.         $this->phone $phone;
  283.         return $this;
  284.     }
  285.     public function getTeam(): ?string
  286.     {
  287.         return $this->team;
  288.     }
  289.     public function setTeam(?string $team): self
  290.     {
  291.         $this->team $team;
  292.         return $this;
  293.     }
  294.     public function getStatus(): ?string
  295.     {
  296.         return $this->status;
  297.     }
  298.     public function setStatus(string $status): self
  299.     {
  300.         $this->status $status;
  301.         return $this;
  302.     }
  303.     public function getMakeAt(): ?\DateTimeInterface
  304.     {
  305.         return $this->makeAt;
  306.     }
  307.     public function setMakeAt(?\DateTimeInterface $makeAt): self
  308.     {
  309.         $this->makeAt $makeAt;
  310.         return $this;
  311.     }
  312.     public function isHasCopyright(): ?bool
  313.     {
  314.         return $this->hasCopyright;
  315.     }
  316.     public function setHasCopyright(?bool $hasCopyright): self
  317.     {
  318.         $this->hasCopyright $hasCopyright;
  319.         return $this;
  320.     }
  321.     public function getThumbnail(): ?string
  322.     {
  323.         return $this->thumbnail;
  324.     }
  325.     public function setThumbnail(?string $thumbnail): self
  326.     {
  327.         $this->thumbnail $thumbnail;
  328.         return $this;
  329.     }
  330.     /**
  331.      * @return Collection<int, ProjectImages>
  332.      */
  333.     public function getProjectImages(): Collection
  334.     {
  335.         return $this->projectImages;
  336.     }
  337.     public function addProjectImage(ProjectImages $projectImage): self
  338.     {
  339.         if (!$this->projectImages->contains($projectImage)) {
  340.             $this->projectImages[] = $projectImage;
  341.             $projectImage->setProject($this);
  342.         }
  343.         return $this;
  344.     }
  345.     public function removeProjectImage(ProjectImages $projectImage): self
  346.     {
  347.         if ($this->projectImages->removeElement($projectImage)) {
  348.             // set the owning side to null (unless already changed)
  349.             if ($projectImage->getProject() === $this) {
  350.                 $projectImage->setProject(null);
  351.             }
  352.         }
  353.         return $this;
  354.     }
  355.     public function isIsPublished(): ?bool
  356.     {
  357.         return $this->isPublished;
  358.     }
  359.     public function setIsPublished(?bool $isPublished): self
  360.     {
  361.         $this->isPublished $isPublished;
  362.         return $this;
  363.     }
  364.     public function getDescription(): ?string
  365.     {
  366.         return $this->description;
  367.     }
  368.     public function setDescription(?string $description): self
  369.     {
  370.         $this->description $description;
  371.         return $this;
  372.     }
  373. }