src/Entity/Project.php line 19
<?phpnamespace App\Entity;use App\Repository\ProjectRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\HttpFoundation\File\UploadedFile;use Vich\UploaderBundle\Mapping\Annotation as Vich;/*** @ORM\Entity(repositoryClass=ProjectRepository::class)* @Vich\Uploadable* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="Project_cache_entity")*/class Project{/*** @ORM\Id* @ORM\GeneratedValue* @ORM\Column(type="integer")*/private $id;/*** @ORM\Column(type="string", length=255)*/private $name;/*** @ORM\Column(type="text", nullable=true)*/private $content;/*** @ORM\Column(type="string", length=255, nullable=true)*/private $slug;/*** @ORM\ManyToOne(targetEntity=Client::class, inversedBy="projects")* @ORM\JoinColumn(nullable=false)*/private $client;/*** @ORM\ManyToMany(targetEntity=Category::class, inversedBy="projects")*/private $category; // aurait dû être au pluriel/*** @ORM\Column(type="integer")*/private $displayOrder;/*** @ORM\Column(type="boolean")*/private $isDisplayed = true;/*** @ORM\Column(type="string", length=255)* @var string*/private $image;/*** @Vich\UploadableField(mapping="project_images", fileNameProperty="image")* @var File*/private $imageFile;/*** @ORM\Column(type="string", length=255, nullable=true)* @var string*/private $featuredImage;/*** @Vich\UploadableField(mapping="project_images", fileNameProperty="featuredImage")* @var File*/private $featuredImageFile;/*** @ORM\Column(type="string", length=255, nullable=true)* @var string*/private $gridImage;/*** @Vich\UploadableField(mapping="project_images", fileNameProperty="gridImage")* @var File*/private $gridImageFile;/*** @ORM\Column(type="datetime", nullable=true)* @var \DateTime*/private $updatedAt;/*** @ORM\Column(type="boolean", nullable=true)*/private $isFeatured = false;/*** @ORM\ManyToMany(targetEntity=User::class, mappedBy="projects")*/private $users;/*** @ORM\OneToMany(targetEntity=Attachment::class, mappedBy="project", orphanRemoval=true, cascade={"persist"})*/private $attachments;public function __construct(){$this->category = new ArrayCollection();$this->users = new ArrayCollection();$this->attachments = new ArrayCollection();}public function getId(): ?int{return $this->id;}/*** @param mixed $id*/public function setId($id): void{$this->id = $id;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getContent(): ?string{return $this->content;}public function setContent(?string $content): self{$this->content = $content;return $this;}public function getSlug(): ?string{return $this->slug;}public function setSlug(?string $slug): self{$this->slug = $slug;return $this;}public function getClient(): ?Client{return $this->client;}public function setClient(?Client $client): self{$this->client = $client;return $this;}/*** @return Collection|Category[]*/public function getCategory(): Collection{return $this->category;}public function addCategory(Category $category): self{if (!$this->category->contains($category)) {$this->category[] = $category;}return $this;}public function removeCategory(Category $category): self{$this->category->removeElement($category);return $this;}public function getDisplayOrder(): ?int{return $this->displayOrder;}public function setDisplayOrder(int $displayOrder): self{$this->displayOrder = $displayOrder;return $this;}public function getIsDisplayed(): ?bool{return $this->isDisplayed;}public function setIsDisplayed(bool $isDisplayed): self{$this->isDisplayed = $isDisplayed;return $this;}public function setImageFile(File $image = null){$this->imageFile = $image;// VERY IMPORTANT:// It is required that at least one field changes if you are using Doctrine,// otherwise the event listeners won't be called and the file is lostif ($image) {// if 'updatedAt' is not defined in your entity, use another property$this->updatedAt = new \DateTime('now');}}public function getImageFile(){return $this->imageFile;}public function setImage($image){$this->image = $image;return $this;}public function getImage(){return $this->image;}public function getIsFeatured(): ?bool{return $this->isFeatured;}public function setIsFeatured(?bool $isFeatured): self{$this->isFeatured = $isFeatured;return $this;}/*** @return Collection|User[]*/public function getUsers(): Collection{return $this->users;}public function addUser(User $user): self{if (!$this->users->contains($user)) {$this->users[] = $user;$user->addProject($this);}return $this;}public function removeUser(User $user): self{if ($this->users->removeElement($user)) {$user->removeProject($this);}return $this;}public function setFeaturedImageFile(File $featuredImage = null){$this->featuredImageFile = $featuredImage;// VERY IMPORTANT:// It is required that at least one field changes if you are using Doctrine,// otherwise the event listeners won't be called and the file is lostif ($featuredImage) {// if 'updatedAt' is not defined in your entity, use another property$this->updatedAt = new \DateTime('now');}}public function getFeaturedImageFile(){return $this->featuredImageFile;}public function setFeaturedImage($featuredImage){$this->featuredImage = $featuredImage;return $this;}public function getFeaturedImage(){return $this->featuredImage;}public function setGridImageFile(File $gridImage = null){$this->gridImageFile = $gridImage;// VERY IMPORTANT:// It is required that at least one field changes if you are using Doctrine,// otherwise the event listeners won't be called and the file is lostif ($gridImage) {// if 'updatedAt' is not defined in your entity, use another property$this->updatedAt = new \DateTime('now');}}public function getGridImageFile(){return $this->gridImageFile;}public function setGridImage($gridImage){$this->gridImage = $gridImage;return $this;}public function getGridImage(){return $this->gridImage;}/*** @return \DateTime*/public function getUpdatedAt(): \DateTime{return $this->updatedAt;}/*** @param \DateTime $updatedAt* @return \DateTime*/public function setUpdatedAt(\DateTime $updatedAt): \DateTime{return $this->updatedAt = $updatedAt;}/*** @return Collection|Attachment[]*/public function getAttachments(): Collection{return $this->attachments;}public function addAttachment(Attachment $attachment): self{if (!$this->attachments->contains($attachment)) {$this->attachments[] = $attachment;$attachment->setProject($this);}return $this;}public function removeAttachment(Attachment $attachment): self{if ($this->attachments->removeElement($attachment)) {// set the owning side to null (unless already changed)if ($attachment->getProject() === $this) {$attachment->setProject(null);}}return $this;}}