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", cascade={"remove"})
  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.     /**
  148.      * @ORM\Column(type="integer", nullable=true)
  149.      */
  150.     private $idPhotoProfil;
  151.     public function __construct()
  152.     {
  153.         $this->sendAt = new \DateTime();
  154.         $this->projectImages = new ArrayCollection();
  155.         $this->isPublished false;
  156.         $this->status self::STATUS_RECEIVED;
  157.         $this->year date('Y');
  158.     }
  159.     public function getId(): ?int
  160.     {
  161.         return $this->id;
  162.     }
  163.     public function getTitle(): ?string
  164.     {
  165.         return $this->title;
  166.     }
  167.     public function setTitle(?string $title): self
  168.     {
  169.         $this->title $title;
  170.         return $this;
  171.     }
  172.     public function getName(): ?string
  173.     {
  174.         return $this->name;
  175.     }
  176.     public function setName(?string $name): self
  177.     {
  178.         $this->name $name;
  179.         return $this;
  180.     }
  181.     public function getText(): ?string
  182.     {
  183.         return $this->text;
  184.     }
  185.     public function setText(?string $text): self
  186.     {
  187.         $this->text $text;
  188.         return $this;
  189.     }
  190.     public function getVideo()
  191.     {
  192.         return $this->video;
  193.     }
  194.     public function setVideo($video)
  195.     {
  196.         $this->video $video;
  197.         return $this;
  198.     }
  199.     public function getCategory(): ?ProjectCategory
  200.     {
  201.         return $this->category;
  202.     }
  203.     public function setCategory(?ProjectCategory $category): self
  204.     {
  205.         $this->category $category;
  206.         return $this;
  207.     }
  208.     public function getSendAt(): ?\DateTimeInterface
  209.     {
  210.         return $this->sendAt;
  211.     }
  212.     public function setSendAt(?\DateTimeInterface $sendAt): self
  213.     {
  214.         $this->sendAt $sendAt;
  215.         return $this;
  216.     }
  217.     public function getYear(): ?int
  218.     {
  219.         return $this->year;
  220.     }
  221.     public function setYear(?int $year): self
  222.     {
  223.         $this->year $year;
  224.         return $this;
  225.     }
  226.     public function getAddress(): ?string
  227.     {
  228.         return $this->address;
  229.     }
  230.     public function setAddress(?string $address): self
  231.     {
  232.         $this->address $address;
  233.         return $this;
  234.     }
  235.     public function getCity(): ?string
  236.     {
  237.         return $this->city;
  238.     }
  239.     public function setCity(?string $city): self
  240.     {
  241.         $this->city $city;
  242.         return $this;
  243.     }
  244.     public function getZipCode(): ?string
  245.     {
  246.         return $this->zipCode;
  247.     }
  248.     public function setZipCode(?string $zipCode): self
  249.     {
  250.         $this->zipCode $zipCode;
  251.         return $this;
  252.     }
  253.     public function getFirstname(): ?string
  254.     {
  255.         return $this->firstname;
  256.     }
  257.     public function setFirstname(?string $firstname): self
  258.     {
  259.         $this->firstname $firstname;
  260.         return $this;
  261.     }
  262.     public function getLastname(): ?string
  263.     {
  264.         return $this->lastname;
  265.     }
  266.     public function setLastname(?string $lastname): self
  267.     {
  268.         $this->lastname $lastname;
  269.         return $this;
  270.     }
  271.     public function getEmail(): ?string
  272.     {
  273.         return $this->email;
  274.     }
  275.     public function setEmail(?string $email): self
  276.     {
  277.         $this->email $email;
  278.         return $this;
  279.     }
  280.     public function getPhone(): ?string
  281.     {
  282.         return $this->phone;
  283.     }
  284.     public function setPhone(?string $phone): self
  285.     {
  286.         $this->phone $phone;
  287.         return $this;
  288.     }
  289.     public function getTeam(): ?string
  290.     {
  291.         return $this->team;
  292.     }
  293.     public function setTeam(?string $team): self
  294.     {
  295.         $this->team $team;
  296.         return $this;
  297.     }
  298.     public function getStatus(): ?string
  299.     {
  300.         return $this->status;
  301.     }
  302.     public function setStatus(string $status): self
  303.     {
  304.         $this->status $status;
  305.         return $this;
  306.     }
  307.     public function getMakeAt(): ?\DateTimeInterface
  308.     {
  309.         return $this->makeAt;
  310.     }
  311.     public function setMakeAt(?\DateTimeInterface $makeAt): self
  312.     {
  313.         $this->makeAt $makeAt;
  314.         return $this;
  315.     }
  316.     public function isHasCopyright(): ?bool
  317.     {
  318.         return $this->hasCopyright;
  319.     }
  320.     public function setHasCopyright(?bool $hasCopyright): self
  321.     {
  322.         $this->hasCopyright $hasCopyright;
  323.         return $this;
  324.     }
  325.     public function getThumbnail(): ?string
  326.     {
  327.         return $this->thumbnail;
  328.     }
  329.     public function setThumbnail(?string $thumbnail): self
  330.     {
  331.         $this->thumbnail $thumbnail;
  332.         return $this;
  333.     }
  334.     /**
  335.      * @return Collection<int, ProjectImages>
  336.      */
  337.     public function getProjectImages(): Collection
  338.     {
  339.         return $this->projectImages;
  340.     }
  341.     public function addProjectImage(ProjectImages $projectImage): self
  342.     {
  343.         if (!$this->projectImages->contains($projectImage)) {
  344.             $this->projectImages[] = $projectImage;
  345.             $projectImage->setProject($this);
  346.         }
  347.         return $this;
  348.     }
  349.     public function removeProjectImage(ProjectImages $projectImage): self
  350.     {
  351.         if ($this->projectImages->removeElement($projectImage)) {
  352.             // set the owning side to null (unless already changed)
  353.             if ($projectImage->getProject() === $this) {
  354.                 $projectImage->setProject(null);
  355.             }
  356.         }
  357.         return $this;
  358.     }
  359.     public function isIsPublished(): ?bool
  360.     {
  361.         return $this->isPublished;
  362.     }
  363.     public function setIsPublished(?bool $isPublished): self
  364.     {
  365.         $this->isPublished $isPublished;
  366.         return $this;
  367.     }
  368.     public function getDescription(): ?string
  369.     {
  370.         return $this->description;
  371.     }
  372.     public function setDescription(?string $description): self
  373.     {
  374.         $this->description $description;
  375.         return $this;
  376.     }
  377.     public function getIdPhotoProfil(): ?int
  378.     {
  379.         return $this->idPhotoProfil;
  380.     }
  381.     public function setIdPhotoProfil(?int $idPhotoProfil): self
  382.     {
  383.         $this->idPhotoProfil $idPhotoProfil;
  384.         return $this;
  385.     }
  386. }