<?php
namespace App\Entity;
use App\Repository\AgencyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\User;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=AgencyRepository::class)
*/
class Agency extends User
{
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="string", length=255)
*/
private $address;
/**
* @ORM\Column(type="string", length=255)
*/
private $phone;
/**
* @ORM\Column(type="boolean")
*/
private $statut;
/**
* @ORM\OneToMany(targetEntity=Bike::class, mappedBy="agency")
*/
private $bikes;
/**
* @ORM\OneToMany(targetEntity=Accessory::class, mappedBy="agency")
*/
private $accessory;
/**
* @ORM\OneToMany(targetEntity=Event::class, mappedBy="agency")
*/
private $events;
/**
* @ORM\OneToMany(targetEntity=History::class, mappedBy="agency")
*/
private $histories;
/**
* @ORM\OneToMany(targetEntity=Order::class, mappedBy="agency")
*/
private $orders;
public function __construct()
{
$this->bikes = new ArrayCollection();
$this->accessory = new ArrayCollection();
$this->events = new ArrayCollection();
$this->histories = new ArrayCollection();
$this->orders = new ArrayCollection();
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): self
{
$this->address = $address;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(string $phone): self
{
$this->phone = $phone;
return $this;
}
public function isStatut(): ?bool
{
return $this->statut;
}
public function setStatut(bool $statut): self
{
$this->statut = $statut;
return $this;
}
/**
* @return Collection<int, Bike>
*/
public function getBikes(): Collection
{
return $this->bikes;
}
public function addBike(Bike $bike): self
{
if (!$this->bikes->contains($bike)) {
$this->bikes[] = $bike;
$bike->setAgency($this);
}
return $this;
}
public function removeBike(Bike $bike): self
{
if ($this->bikes->removeElement($bike)) {
// set the owning side to null (unless already changed)
if ($bike->getAgency() === $this) {
$bike->setAgency(null);
}
}
return $this;
}
/**
* @return Collection<int, Accessory>
*/
public function getAccessory(): Collection
{
return $this->accessory;
}
public function addAccessory(Accessory $accessory): self
{
if (!$this->accessory->contains($accessory)) {
$this->accessory[] = $accessory;
$accessory->setAgency($this);
}
return $this;
}
public function removeAccessory(Accessory $accessory): self
{
if ($this->accessory->removeElement($accessory)) {
// set the owning side to null (unless already changed)
if ($accessory->getAgency() === $this) {
$accessory->setAgency(null);
}
}
return $this;
}
/**
* @return Collection<int, Event>
*/
public function getEvents(): Collection
{
return $this->events;
}
public function addEvent(Event $event): self
{
if (!$this->events->contains($event)) {
$this->events[] = $event;
$event->setAgency($this);
}
return $this;
}
public function removeEvent(Event $event): self
{
if ($this->events->removeElement($event)) {
// set the owning side to null (unless already changed)
if ($event->getAgency() === $this) {
$event->setAgency(null);
}
}
return $this;
}
/**
* @return Collection<int, History>
*/
public function getHistories(): Collection
{
return $this->histories;
}
public function addHistory(History $history): self
{
if (!$this->histories->contains($history)) {
$this->histories[] = $history;
$history->setAgency($this);
}
return $this;
}
public function removeHistory(History $history): self
{
if ($this->histories->removeElement($history)) {
// set the owning side to null (unless already changed)
if ($history->getAgency() === $this) {
$history->setAgency(null);
}
}
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setAgency($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getAgency() === $this) {
$order->setAgency(null);
}
}
return $this;
}
}