<?php
namespace App\Entity;
use App\Repository\PtfRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Entity(repositoryClass: PtfRepository::class)]
class Ptf
{
#[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)]
private $nom;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $logo;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $telephone;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $email;
#[ORM\Column(type: 'text', nullable: true)]
private $horaire;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $url;
#[ORM\OneToMany(mappedBy: 'ptf', targetEntity: User::class)]
private $users;
#[ORM\ManyToMany(targetEntity: Groupe::class, inversedBy: 'ptfs')]
private $groupe;
#[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(type: 'datetime')]
private $created_at;
#[Gedmo\Timestampable(on: 'update')]
#[ORM\Column(type: 'datetime')]
private $updated_at;
#[ORM\Column(type: 'integer')]
private $created_by;
#[ORM\Column(type: 'integer')]
private $updated_by;
#[ORM\ManyToOne(targetEntity: Pays::class, inversedBy: 'ptfs')]
private $pays;
#[ORM\Column(length: 255, nullable: true)]
private ?string $type = null;
#[ORM\OneToMany(mappedBy: 'ptf', targetEntity: Troika::class)]
private Collection $troikas;
public function __construct()
{
$this->users = new ArrayCollection();
$this->groupe = new ArrayCollection();
$this->troikas = new ArrayCollection();
}
public function __toString()
{
return $this->getNom() . ' (' . $this->getCode().')';
}
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 getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getHoraire(): ?string
{
return $this->horaire;
}
public function setHoraire(?string $horaire): self
{
$this->horaire = $horaire;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setPtf($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getPtf() === $this) {
$user->setPtf(null);
}
}
return $this;
}
/**
* @return Collection<int, Groupe>
*/
public function getGroupe(): Collection
{
return $this->groupe;
}
public function addGroupe(Groupe $groupe): self
{
if (!$this->groupe->contains($groupe)) {
$this->groupe[] = $groupe;
}
return $this;
}
public function removeGroupe(Groupe $groupe): self
{
$this->groupe->removeElement($groupe);
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getCreatedBy(): ?int
{
return $this->created_by;
}
public function setCreatedBy(int $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getUpdatedBy(): ?int
{
return $this->updated_by;
}
public function setUpdatedBy(int $updated_by): self
{
$this->updated_by = $updated_by;
return $this;
}
public function getPays(): ?Pays
{
return $this->pays;
}
public function setPays(?Pays $pays): self
{
$this->pays = $pays;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
/**
* @return Collection<int, Troika>
*/
public function getTroikas(): Collection
{
return $this->troikas;
}
public function addTroika(Troika $troika): self
{
if (!$this->troikas->contains($troika)) {
$this->troikas->add($troika);
$troika->setPtf($this);
}
return $this;
}
public function removeTroika(Troika $troika): self
{
if ($this->troikas->removeElement($troika)) {
// set the owning side to null (unless already changed)
if ($troika->getPtf() === $this) {
$troika->setPtf(null);
}
}
return $this;
}
}