src/Entity/Mutuality.php line 17
<?phpnamespace App\Entity;use App\Model\Wallet\WalletInterface;use App\Repository\MutualityRepository;use App\Trait\ActivableTrait;use App\Trait\ArrayableTrait;use App\Trait\DateTrait;use App\Trait\DeletableTrait;use App\Trait\WalletTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: MutualityRepository::class)]class Mutuality implements WalletInterface{use DateTrait {DateTrait::__construct as dateConstruct;}use ActivableTrait;use DeletableTrait;use ArrayableTrait;use WalletTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\ManyToOne(cascade: ["persist"], inversedBy: 'mutualities')]private ?User $user = null;#[ORM\ManyToOne(inversedBy: 'mutualities')]private ?Establishment $establishment = null;#[ORM\Column]private ?float $amount = null;#[ORM\ManyToOne]private ?Currency $currency = null;#[ORM\ManyToOne(inversedBy: 'mutualities')]private ?Client $client = null;#[ORM\ManyToMany(targetEntity: ArticleDepartment::class, cascade: ['persist'])]private Collection $articles;private ?string $fullname = "";#[ORM\OneToMany(mappedBy: 'mutuality', targetEntity: Document::class)]private Collection $documents;#[ORM\OneToOne(cascade: ['persist', 'remove'])]private ?Address $address = null;#[ORM\OneToMany(mappedBy: 'mutuality', targetEntity: Card::class)]private Collection $cards;#[ORM\ManyToOne(inversedBy: 'mutualities')]private ?Employee $employee = null;#[ORM\Column(length: 255, unique: true)]private ?string $ref = null;#[ORM\ManyToOne(inversedBy: 'mutualities')]private ?MutualityCategory $category = null;public function __construct(){$this->dateConstruct();$this->articles = new ArrayCollection();if (!$this->getUser()) {$this->fullname = $this->getClient() ?? $this->getEmployee() ?? $this->getUser();}$this->documents = new ArrayCollection();$this->cards = new ArrayCollection();}public function __toString(): string{return $this->getFullname();}public function getId(): ?int{return $this->id;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): static{$this->user = $user;return $this;}public function getEstablishment(): ?Establishment{return $this->establishment;}public function setEstablishment(?Establishment $establishment): static{$this->establishment = $establishment;return $this;}public function getAmount(): ?float{return $this->amount;}public function setAmount(float $amount): static{$this->amount = $amount;return $this;}public function getCurrency(): ?Currency{return $this->currency;}public function setCurrency(?Currency $currency): static{$this->currency = $currency;return $this;}public function getClient(): ?Client{return $this->client;}public function setClient(?Client $client): static{$this->client = $client;return $this;}/*** @return Collection<int, ArticleDepartment>*/public function getArticles(): Collection{return $this->articles;}public function addArticle(ArticleDepartment $article): static{if (!$this->articles->contains($article)) {$this->articles->add($article);}return $this;}public function removeArticle(ArticleDepartment $article): static{$this->articles->removeElement($article);return $this;}/*** @return Collection<int, Document>*/public function getDocuments(): Collection{return $this->documents;}public function addDocument(Document $document): static{if (!$this->documents->contains($document)) {$this->documents->add($document);$document->setMutuality($this);}return $this;}public function removeDocument(Document $document): static{if ($this->documents->removeElement($document)) {// set the owning side to null (unless already changed)if ($document->getMutuality() === $this) {$document->setMutuality(null);}}return $this;}public function getAddress(): ?Address{return $this->address;}public function setAddress(?Address $address): static{$this->address = $address;return $this;}public function getFullname(): string{$this->fullname = $this->getClient() ?? $this->getEmployee() ?? $this->getUser();return $this->fullname;}/*** @return Collection<int, Card>*/public function getCards(): Collection{return $this->cards;}public function addCard(Card $card): static{if (!$this->cards->contains($card)) {$this->cards->add($card);$card->setMutuality($this);}return $this;}public function removeCard(Card $card): static{if ($this->cards->removeElement($card)) {// set the owning side to null (unless already changed)if ($card->getMutuality() === $this) {$card->setMutuality(null);}}return $this;}public function getEmployee(): ?Employee{return $this->employee;}public function setEmployee(?Employee $employee): static{$this->employee = $employee;return $this;}public function getRef(): ?string{return $this->ref;}public function setRef(string $ref): static{$this->ref = $ref;return $this;}public function getCategory(): ?MutualityCategory{return $this->category;}public function setCategory(?MutualityCategory $category): static{$this->category = $category;return $this;}}