<?php
namespace 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\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=ProjectRepository::class)
*/
class Project
{
const PROJECT_PUBLISHED = 1;
const PROJECT_NOT_PUBLISHED = 0;
const STATUS_RECEIVED = 'received';
const STATUS_NOMINATED = 'nominated';
const STATUS_WINNER = 'winner';
const TEAM_HERO = 'hero';
const TEAM_MINI_HERO = 'mini-hero';
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez donner un titre à votre projet")
*/
private $title;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner le nom de votre structure")
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner le texte en cas de victoire")
*/
private $text;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $video;
/**
* @ORM\ManyToOne(targetEntity=ProjectCategory::class, inversedBy="projects")
*
* @Assert\NotBlank(message="Veuillez choisir une catégorie")
*/
private $category;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $sendAt;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner le nom de votre structure")
*/
private $year;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner le numéro et nom de la rue")
*/
private $address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner votre commune")
*/
private $city;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner votre code postal")
*/
private $zipCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner votre prénom")
*/
private $firstname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner votre nom de famille")
*/
private $lastname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner votre adresse mail")
* @Assert\Email(message="Veuillez renseigner une adresse mail valide")
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez renseigner votre numéro de téléphone")
*/
private $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(message="Veuillez choisir votre équipe")
*/
private $team;
/**
* @ORM\Column(type="string", length=255)
*/
private $status;
/**
* @ORM\Column(type="date", nullable=true)
*
* @Assert\NotBlank(message="Veuillez sélectionner la date de fin de projet")
*/
private $makeAt;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Assert\IsTrue(message="Vous devez confirmer les droits d'auteur")
*/
private $hasCopyright;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $thumbnail;
/**
* @ORM\OneToMany(targetEntity=ProjectImages::class, mappedBy="project", cascade={"remove"})
*/
private $projectImages;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isPublished;
/**
* @ORM\Column(type="text", nullable=true)
*
* @Assert\NotBlank(message="Veuillez ajouter une description du projet")
*/
private $description;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $idPhotoProfil;
public function __construct()
{
$this->sendAt = new \DateTime();
$this->projectImages = new ArrayCollection();
$this->isPublished = false;
$this->status = self::STATUS_RECEIVED;
$this->year = date('Y');
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getVideo()
{
return $this->video;
}
public function setVideo($video)
{
$this->video = $video;
return $this;
}
public function getCategory(): ?ProjectCategory
{
return $this->category;
}
public function setCategory(?ProjectCategory $category): self
{
$this->category = $category;
return $this;
}
public function getSendAt(): ?\DateTimeInterface
{
return $this->sendAt;
}
public function setSendAt(?\DateTimeInterface $sendAt): self
{
$this->sendAt = $sendAt;
return $this;
}
public function getYear(): ?int
{
return $this->year;
}
public function setYear(?int $year): self
{
$this->year = $year;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getZipCode(): ?string
{
return $this->zipCode;
}
public function setZipCode(?string $zipCode): self
{
$this->zipCode = $zipCode;
return $this;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(?string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(?string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getTeam(): ?string
{
return $this->team;
}
public function setTeam(?string $team): self
{
$this->team = $team;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getMakeAt(): ?\DateTimeInterface
{
return $this->makeAt;
}
public function setMakeAt(?\DateTimeInterface $makeAt): self
{
$this->makeAt = $makeAt;
return $this;
}
public function isHasCopyright(): ?bool
{
return $this->hasCopyright;
}
public function setHasCopyright(?bool $hasCopyright): self
{
$this->hasCopyright = $hasCopyright;
return $this;
}
public function getThumbnail(): ?string
{
return $this->thumbnail;
}
public function setThumbnail(?string $thumbnail): self
{
$this->thumbnail = $thumbnail;
return $this;
}
/**
* @return Collection<int, ProjectImages>
*/
public function getProjectImages(): Collection
{
return $this->projectImages;
}
public function addProjectImage(ProjectImages $projectImage): self
{
if (!$this->projectImages->contains($projectImage)) {
$this->projectImages[] = $projectImage;
$projectImage->setProject($this);
}
return $this;
}
public function removeProjectImage(ProjectImages $projectImage): self
{
if ($this->projectImages->removeElement($projectImage)) {
// set the owning side to null (unless already changed)
if ($projectImage->getProject() === $this) {
$projectImage->setProject(null);
}
}
return $this;
}
public function isIsPublished(): ?bool
{
return $this->isPublished;
}
public function setIsPublished(?bool $isPublished): self
{
$this->isPublished = $isPublished;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getIdPhotoProfil(): ?int
{
return $this->idPhotoProfil;
}
public function setIdPhotoProfil(?int $idPhotoProfil): self
{
$this->idPhotoProfil = $idPhotoProfil;
return $this;
}
}