<?php
namespace App\Entity;
use App\Repository\MembreRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=MembreRepository::class)
*/
class Membre
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Federation::class, inversedBy="membres")
*/
private $federation;
/**
* @ORM\OneToOne(targetEntity=User::class, inversedBy="membre", cascade={"persist", "remove"})
*/
private $user;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $adhesion;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $photo;
/**
* @ORM\OneToMany(targetEntity=Cotisation::class, mappedBy="membre")
*/
private $cotisations;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $cadre;
/**
* @ORM\OneToMany(targetEntity=Transaction::class, mappedBy="membre")
*/
private $transactions;
/**
* @ORM\ManyToOne(targetEntity=Commune::class, inversedBy="membres")
*/
private $commune;
public function __construct()
{
$this->cotisations = new ArrayCollection();
$this->transactions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getFederation(): ?Federation
{
return $this->federation;
}
public function setFederation(?Federation $federation): self
{
$this->federation = $federation;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getAdhesion(): ?\DateTimeInterface
{
return $this->adhesion;
}
public function setAdhesion(?\DateTimeInterface $adhesion): self
{
$this->adhesion = $adhesion;
return $this;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(?string $photo): self
{
$this->photo = $photo;
return $this;
}
/**
* @return Collection<int, Cotisation>
*/
public function getCotisations(): Collection
{
return $this->cotisations;
}
public function addCotisation(Cotisation $cotisation): self
{
if (!$this->cotisations->contains($cotisation)) {
$this->cotisations[] = $cotisation;
$cotisation->setMembre($this);
}
return $this;
}
public function removeCotisation(Cotisation $cotisation): self
{
if ($this->cotisations->removeElement($cotisation)) {
// set the owning side to null (unless already changed)
if ($cotisation->getMembre() === $this) {
$cotisation->setMembre(null);
}
}
return $this;
}
public function getCadre(): ?bool
{
return $this->cadre;
}
public function setCadre(?bool $cadre): self
{
$this->cadre = $cadre;
return $this;
}
/**
* @return Collection<int, Transaction>
*/
public function getTransactions(): Collection
{
return $this->transactions;
}
public function addTransaction(Transaction $transaction): self
{
if (!$this->transactions->contains($transaction)) {
$this->transactions[] = $transaction;
$transaction->setMembre($this);
}
return $this;
}
public function removeTransaction(Transaction $transaction): self
{
if ($this->transactions->removeElement($transaction)) {
// set the owning side to null (unless already changed)
if ($transaction->getMembre() === $this) {
$transaction->setMembre(null);
}
}
return $this;
}
public function getCommune(): ?Commune
{
return $this->commune;
}
public function setCommune(?Commune $commune): self
{
$this->commune = $commune;
return $this;
}
}