<?php
namespace App\Entity;
use App\Repository\DemandeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DemandeRepository::class)
*/
class Demande
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="demandes")
* @ORM\JoinColumn(nullable=false)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity=Livre::class, inversedBy="demandes")
* @ORM\JoinColumn(nullable=false)
*/
private $livre;
/**
* @ORM\Column(type="integer")
*/
private $status;
/**
* @ORM\ManyToOne(targetEntity=Livre::class, inversedBy="demandes")
*/
private $livre2;
/**
* @ORM\Column(type="datetime")
*/
private $date;
/**
* @ORM\OneToMany(targetEntity=Notification::class, mappedBy="demande")
*/
private $notifications;
public function __construct()
{
$this->notifications = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getLivre(): ?Livre
{
return $this->livre;
}
public function setLivre(?Livre $livre): self
{
$this->livre = $livre;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
public function getLivre2(): ?Livre
{
return $this->livre2;
}
public function setLivre2(?Livre $livre2): self
{
$this->livre2 = $livre2;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
/**
* @return Collection<int, Notification>
*/
public function getNotifications(): Collection
{
return $this->notifications;
}
public function addNotification(Notification $notification): self
{
if (!$this->notifications->contains($notification)) {
$this->notifications[] = $notification;
$notification->setDemande($this);
}
return $this;
}
public function removeNotification(Notification $notification): self
{
if ($this->notifications->removeElement($notification)) {
// set the owning side to null (unless already changed)
if ($notification->getDemande() === $this) {
$notification->setDemande(null);
}
}
return $this;
}
}