<?php
namespace App\Entity;
use App\Repository\CoursRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CoursRepository::class)
*/
class Cours
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $code;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nom;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $link;
/**
* @ORM\Column(type="integer")
*/
private $id_course;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $begin;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $end;
/**
* @ORM\Column(name="dateMaj",type="string", length=255, nullable=true)
*/
private $dateMaj;
/**
* @ORM\ManyToMany(targetEntity=Projet::class, inversedBy="courses")
* @ORM\JoinColumn(name="idProjet", referencedColumnName="id")
*/
private $projets;
/**
* One Cours has Many campagnes.
* @ORM\OneToMany(targetEntity=Compagne::class, mappedBy="cours")
*/
private $campagnes;
public function __construct()
{
$this->projets = new ArrayCollection();
$this->campagnes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(?string $link): self
{
$this->link = $link;
return $this;
}
public function getIdCourse(): ?int
{
return $this->id_course;
}
public function setIdCourse(int $id_course): self
{
$this->id_course = $id_course;
return $this;
}
public function getBegin(): ?string
{
return $this->begin;
}
public function setBegin(?string $begin): self
{
$this->begin = $begin;
return $this;
}
public function getEnd(): ?string
{
return $this->end;
}
public function setEnd(?string $end): self
{
$this->end = $end;
return $this;
}
public function getDateMaj(): ?string
{
return $this->dateMaj;
}
public function setDateMaj(?string $dateMaj): self
{
$this->dateMaj = $dateMaj;
return $this;
}
/**
* @return Collection|Projet[]
*/
public function getProjets(): Collection
{
return $this->projets;
}
public function addProjet(Projet $projet): self
{
if (!$this->projets->contains($projet)) {
$this->projets[] = $projet;
}
return $this;
}
public function removeProjet(Projet $projet): self
{
if ($this->projets->contains($projet)) {
$this->projets->removeElement($projet);
}
return $this;
}
/**
* @return Collection|Compagne[]
*/
public function getCampagnes(): Collection
{
return $this->campagnes;
}
public function addCampagne(Compagne $campagne): self
{
if (!$this->campagnes->contains($campagne)) {
$this->campagnes[] = $campagne;
$campagne->setCours($this);
}
return $this;
}
public function removeCampagne(Compagne $campagne): self
{
if ($this->campagnes->contains($campagne)) {
$this->campagnes->removeElement($campagne);
// set the owning side to null (unless already changed)
if ($campagne->getCours() === $this) {
$campagne->setCours(null);
}
}
return $this;
}
}