src/Entity/Establishment.php line 62
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use ApiPlatform\Metadata\GetCollection;use ApiPlatform\Metadata\Get;use ApiPlatform\Metadata\Post;use App\Controller\Api\Establishment\ApiEstablishmentGetByUserController;use App\Controller\Api\Establishment\ApiEstablishmentLoginController;use App\Controller\Api\Establishment\ApiEstablishmentJoinController;use App\Controller\Api\Establishment\ApiEstablishmentRegisterController;use App\Controller\Api\Order\ApiEstablishmentOrderNewController;use App\Kimia;use App\Model\Wallet\WalletInterface;use App\Repository\EstablishmentRepository;use App\Trait\ActivableTrait;use App\Trait\ArrayableTrait;use App\Trait\CurrentStateTrait;use App\Trait\DateTrait;use App\Trait\DeletableTrait;use App\Trait\WalletTrait;use DateTimeImmutable;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ReadableCollection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;#[ORM\Entity(repositoryClass: EstablishmentRepository::class)]#[ApiResource(operations: [new GetCollection(uriTemplate: 'user/establishments',controller: ApiEstablishmentGetByUserController::class,),new GetCollection(),new Get(normalizationContext: ['groups' => ['establishment:list', 'establishment:view']]),new Post(uriTemplate: '/establishment/login/{key}',controller: ApiEstablishmentLoginController::class,read: false,deserialize: false),new Post(uriTemplate: '/establishment/join',controller: ApiEstablishmentJoinController::class,read: false,),new Post(uriTemplate: '/establishment/register',controller: ApiEstablishmentRegisterController::class,denormalizationContext: ['groups' => ['establishment:register']],write: false),],normalizationContext: ['groups' => ['establishment:list']])]class Establishment implements WalletInterface{use DateTrait;use ActivableTrait;use ArrayableTrait;use CurrentStateTrait;use DeletableTrait;use WalletTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['establishment:list'])]private ?int $id = null;#[ORM\Column(length: 255)]#[Groups(['establishment:list', 'establishment:register', 'establishment:login'])]private ?string $name = null;#[ORM\Column(length: 255, nullable: true)]#[Groups(['establishment:list', 'establishment:register'])]private ?string $slogan = null;#[ORM\Column(type: Types::TEXT)]#[Groups(['establishment:view', 'establishment:register'])]private ?string $content = null;#[ORM\ManyToOne(cascade: ["persist", "remove"])]#[ORM\JoinColumn(nullable: true)]#[Groups(['establishment:list'])]private ?Attachment $thumbnail = null;#[ORM\ManyToOne(cascade: ["persist", "remove"])]#[ORM\JoinColumn(nullable: true)]#[Groups(['establishment:list'])]private ?Attachment $thumbnailSmall = null;#[ORM\ManyToOne(cascade: ["persist", "remove"])]#[ORM\JoinColumn(nullable: true)]#[Groups(['establishment:list'])]private ?Attachment $thumbnailBlack = null;#[ORM\ManyToOne(cascade: ["persist", "remove"])]#[ORM\JoinColumn(nullable: true)]#[Groups(['establishment:list'])]private ?Attachment $thumbnailBlackSmall = null;#[ORM\Column(length: 255, nullable: true)]private ?string $thumbnailDisplay;#[ORM\ManyToOne(inversedBy: 'establishments')]#[ORM\JoinColumn(nullable: false)]private ?User $user = null;#[ORM\ManyToOne(cascade: ["persist"])]#[ORM\JoinColumn(nullable: false)]#[Groups(['establishment:view', 'establishment:register'])]private ?Address $address = null;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Department::class, orphanRemoval: true)]private Collection $departments;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Document::class, cascade: ["persist", "remove"], orphanRemoval: true)]#[Groups(['establishment:view'])]private Collection $documents;#[ORM\Column(length: 180)]#[Groups(['establishment:view', 'establishment:register'])]private ?string $email = null;#[ORM\Column(length: 15)]#[Groups(['establishment:view', 'establishment:register'])]private ?string $phone = null;#[ORM\Column(nullable: true, options: ["unsigned" => true])]#[Groups(['establishment:view', 'establishment:register'])]private ?int $size = 0;#[ORM\Column(length: 255)]#[Groups(['establishment:view', 'establishment:register'])]private ?string $type = '';#[ORM\Column(length: 255)]#[Groups(['establishment:view', 'establishment:register'])]private ?string $objective = '';#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: ConnectionLog::class, orphanRemoval: true)]private Collection $connectionLogs;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Client::class, orphanRemoval: true)]private Collection $clients;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Planning::class, orphanRemoval: true)]private Collection $plannings;#[ORM\ManyToOne]#[Groups(['establishment:list'])]private ?Currency $currency = null;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Invitation::class)]private Collection $invitations;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Operation::class, orphanRemoval: true)]private Collection $operations;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Article::class, orphanRemoval: true)]private Collection $articles;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Collections::class, orphanRemoval: true)]private Collection $collections;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Journal::class, orphanRemoval: true)]private Collection $journals;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Supply::class, orphanRemoval: true)]private Collection $supplies;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Promotion::class, orphanRemoval: true)]private Collection $promotions;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Rate::class, orphanRemoval: true, cascade: ['persist'])]private Collection $rates;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Employee::class)]private Collection $employees;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Subscription::class, cascade: ["all"])]private Collection $subscriptions;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Order::class, orphanRemoval: true)]private Collection $orders;#[ORM\OneToOne(mappedBy: 'establishment', cascade: ['persist', 'remove'])]private ?Configuration $configuration = null;#[ORM\ManyToOne]private ?Model $model = null;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Menu::class, orphanRemoval: true)]private Collection $menus;#[ORM\Column(length: 255, nullable: true)]private ?string $slug = null;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: QrCode::class, orphanRemoval: true)]private Collection $qrCodes;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Bot::class, orphanRemoval: true)]private Collection $bots;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Role::class)]private Collection $roleWorkers;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Advertisement::class, orphanRemoval: true)]private Collection $advertisements;#[ORM\Column(length: 255, nullable: true)]private ?string $rccm = null;#[ORM\Column(length: 255, nullable: true)]private ?string $idNat = null;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Contract::class)]private Collection $contracts;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Mutuality::class)]private Collection $mutualities;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: MutualityCategory::class)]private Collection $mutualityCategories;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: CardType::class)]private Collection $cardTypes;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Gateway::class, orphanRemoval: true)]private Collection $gateways;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: Currency::class, orphanRemoval: true, cascade: ['persist'])]private Collection $currencies;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: ArticleDepartment::class, orphanRemoval: true)]private Collection $articleDepartments;#[ORM\OneToMany(mappedBy: 'establishment', targetEntity: WalletOperation::class)]private Collection $walletOperations;public function __construct(){$this->isActive = 0;$this->currentState = 'draft';if (!$this->createdAt) $this->createdAt = new DateTimeImmutable();$this->updatedAt = new DateTimeImmutable();$this->thumbnailDisplay = Kimia::THUMBNAIL_PROFILE;$this->supportWallets();$this->departments = new ArrayCollection();$this->articles = new ArrayCollection();$this->collections = new ArrayCollection();$this->promotions = new ArrayCollection();$this->supplies = new ArrayCollection();$this->clients = new ArrayCollection();$this->operations = new ArrayCollection();$this->plannings = new ArrayCollection();$this->invitations = new ArrayCollection();$this->documents = new ArrayCollection();$this->journals = new ArrayCollection();$this->connectionLogs = new ArrayCollection();$this->rates = new ArrayCollection();$this->employees = new ArrayCollection();$this->subscriptions = new ArrayCollection();$this->orders = new ArrayCollection();$this->menus = new ArrayCollection();$this->qrCodes = new ArrayCollection();$this->bots = new ArrayCollection();$this->roleWorkers = new ArrayCollection();$this->advertisements = new ArrayCollection();$this->contracts = new ArrayCollection();$this->mutualities = new ArrayCollection();$this->mutualityCategories = new ArrayCollection();$this->cardTypes = new ArrayCollection();$this->gateways = new ArrayCollection();$this->currencies = new ArrayCollection();$this->articleDepartments = new ArrayCollection();$this->walletOperations = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getSlogan(): ?string{return $this->slogan;}public function setSlogan(?string $slogan): self{$this->slogan = $slogan;return $this;}public function getContent(): ?string{return $this->content;}public function setContent(string $content): self{$this->content = $content;return $this;}public function getThumbnail(): ?Attachment{return $this->thumbnail;}public function setThumbnail(?Attachment $thumbnail): self{$this->thumbnail = $thumbnail;return $this;}public function getThumbnailSmall(): ?Attachment{return $this->thumbnailSmall;}public function setThumbnailSmall(?Attachment $thumbnailSmall): self{$this->thumbnailSmall = $thumbnailSmall;return $this;}public function getThumbnailBlack(): ?Attachment{return $this->thumbnailBlack;}public function setThumbnailBlack(?Attachment $thumbnail): self{$this->thumbnailBlack = $thumbnail;return $this;}public function getThumbnailBlackSmall(): ?Attachment{return $this->thumbnailBlackSmall;}public function setThumbnailBlackSmall(?Attachment $thumbnailSmall): self{$this->thumbnailBlackSmall = $thumbnailSmall;return $this;}public function getThumbnailDisplay(): ?string{return $this->thumbnailDisplay;}public function setThumbnailDisplay(?string $thumbnailDisplay): self{$this->thumbnailDisplay = $thumbnailDisplay;return $this;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}public function getAddress(): ?Address{return $this->address;}public function setAddress(?Address $address): self{$this->address = $address;return $this;}/*** @return Collection<int, Department>*/public function getDepartments(): Collection{return $this->departments;}public function addDepartment(Department $department): self{if (!$this->departments->contains($department)) {$this->departments->add($department);$department->setEstablishment($this);}return $this;}public function removeDepartment(Department $department): self{if ($this->departments->removeElement($department)) {// set the owning side to null (unless already changed)if ($department->getEstablishment() === $this) {$department->setEstablishment(null);}}return $this;}/*** @return Collection<int, Document>*/public function getDocuments(): Collection{return $this->documents;}public function addDocument(Document $document): self{if (!$this->documents->contains($document)) {$this->documents->add($document);$document->setEstablishment($this);}return $this;}public function removeDocument(Document $document): self{if ($this->documents->removeElement($document)) {// set the owning side to null (unless already changed)if ($document->getEstablishment() === $this) {$document->setEstablishment(null);}}return $this;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): self{$this->email = $email;return $this;}public function getPhone(): ?string{return $this->phone;}public function setPhone(string $phone): self{$this->phone = preg_replace('/^(\+243|0|00243)([0-9]{9})$/', '243$2', $phone);return $this;}public function getSize(): ?int{return $this->size;}public function setSize(?int $size): self{$this->size = $size;return $this;}public function getType(): ?string{return $this->type;}public static function getTypeList(): array{return ["Facturation" => Kimia::TYPE_BILLING,"Billetterie" => Kimia::TYPE_TICKET,];}public function setType(string $type): self{$this->type = $type;return $this;}public function getObjective(): ?string{return $this->objective;}public function setObjective(string $objective): self{$this->objective = $objective;return $this;}/*** @return Collection<int, ConnectionLog>*/public function getConnectionLogs(): Collection{return $this->connectionLogs;}public function addConnectionLog(ConnectionLog $connectionLog): self{if (!$this->connectionLogs->contains($connectionLog)) {$this->connectionLogs->add($connectionLog);$connectionLog->setEstablishment($this);}return $this;}public function removeConnectionLog(ConnectionLog $connectionLog): self{if ($this->connectionLogs->removeElement($connectionLog)) {// set the owning side to null (unless already changed)if ($connectionLog->getEstablishment() === $this) {$connectionLog->setEstablishment(null);}}return $this;}/*** @return Collection<int, Client>*/public function getClients(): Collection{return $this->clients;}public function addClient(Client $client): self{if (!$this->clients->contains($client)) {$this->clients->add($client);$client->setEstablishment($this);}return $this;}public function removeClient(Client $client): self{if ($this->clients->removeElement($client)) {// set the owning side to null (unless already changed)if ($client->getEstablishment() === $this) {$client->setEstablishment(null);}}return $this;}/*** @return Collection<int, Planning>*/public function getPlannings(): Collection{return $this->plannings;}public function addPlanning(Planning $planning): self{if (!$this->plannings->contains($planning)) {$this->plannings->add($planning);$planning->setEstablishment($this);}return $this;}public function removePlanning(Planning $planning): self{if ($this->plannings->removeElement($planning)) {// set the owning side to null (unless already changed)if ($planning->getEstablishment() === $this) {$planning->setEstablishment(null);}}return $this;}public function getCurrency(): ?Currency{return $this->currency;}public function setCurrency(?Currency $currency): self{$this->currency = $currency;return $this;}/*** @return Collection<int, Invitation>*/public function getInvitations(): Collection{return $this->invitations;}public function addInvitation(Invitation $invitation): self{if (!$this->invitations->contains($invitation)) {$this->invitations->add($invitation);$invitation->setEstablishment($this);}return $this;}public function removeInvitation(Invitation $invitation): self{if ($this->invitations->removeElement($invitation)) {// set the owning side to null (unless already changed)if ($invitation->getEstablishment() === $this) {$invitation->setEstablishment(null);}}return $this;}/*** @return Collection<int, Operation>*/public function getOperations(): Collection{return $this->operations;}public function addOperation(Operation $operation): self{if (!$this->operations->contains($operation)) {$this->operations->add($operation);$operation->setEstablishment($this);}return $this;}public function removeOperation(Operation $operation): self{if ($this->operations->removeElement($operation)) {// set the owning side to null (unless already changed)if ($operation->getEstablishment() === $this) {$operation->setEstablishment(null);}}return $this;}/*** @return Collection<int, Article>*/public function getArticles(): Collection{return $this->articles;}public function addArticle(Article $article): self{if (!$this->articles->contains($article)) {$this->articles->add($article);$article->setEstablishment($this);}return $this;}public function removeArticle(Article $article): self{if ($this->articles->removeElement($article)) {// set the owning side to null (unless already changed)if ($article->getEstablishment() === $this) {$article->setEstablishment(null);}}return $this;}/*** @return Collection<int, Collections>*/public function getCollections(): Collection{return $this->collections;}public function addCollection(Collections $collection): self{if (!$this->collections->contains($collection)) {$this->collections->add($collection);$collection->setEstablishment($this);}return $this;}public function removeCollection(Collections $collection): self{if ($this->collections->removeElement($collection)) {// set the owning side to null (unless already changed)if ($collection->getEstablishment() === $this) {$collection->setEstablishment(null);}}return $this;}/*** @return Collection<int, Journal>*/public function getJournals(): Collection{return $this->journals;}public function addJournal(Journal $journal): self{if (!$this->journals->contains($journal)) {$this->journals->add($journal);$journal->setEstablishment($this);}return $this;}public function removeJournal(Journal $journal): self{if ($this->journals->removeElement($journal)) {// set the owning side to null (unless already changed)if ($journal->getEstablishment() === $this) {$journal->setEstablishment(null);}}return $this;}/*** @return Collection<int, Supply>*/public function getSupplies(): Collection{return $this->supplies;}public function addSupply(Supply $supply): self{if (!$this->supplies->contains($supply)) {$this->supplies->add($supply);$supply->setEstablishment($this);}return $this;}public function removeSupply(Supply $supply): self{if ($this->supplies->removeElement($supply)) {// set the owning side to null (unless already changed)if ($supply->getEstablishment() === $this) {$supply->setEstablishment(null);}}return $this;}/*** @return Collection<int, Promotion>*/public function getPromotions(): Collection{return $this->promotions;}public function addPromotion(Promotion $promotion): self{if (!$this->promotions->contains($promotion)) {$this->promotions->add($promotion);$promotion->setEstablishment($this);}return $this;}public function removePromotion(Promotion $promotion): self{if ($this->promotions->removeElement($promotion)) {// set the owning side to null (unless already changed)if ($promotion->getEstablishment() === $this) {$promotion->setEstablishment(null);}}return $this;}/*** @return Collection<int, Rate>*/public function getRates(): Collection{return $this->rates;}public function addRate(Rate $rate): self{if (!$this->rates->contains($rate)) {$this->rates->add($rate);$rate->setEstablishment($this);}return $this;}public function removeRate(Rate $rate): self{if ($this->rates->removeElement($rate)) {// set the owning side to null (unless already changed)if ($rate->getEstablishment() === $this) {$rate->setEstablishment(null);}}return $this;}/*** @return Collection<int, Employee>*/public function getEmployees(): Collection{return $this->employees;}public function addEmployee(Employee $employee): self{if (!$this->employees->contains($employee)) {$this->employees->add($employee);$employee->setEstablishment($this);}return $this;}public function removeEmployee(Employee $employee): self{if ($this->employees->removeElement($employee)) {// set the owning side to null (unless already changed)if ($employee->getEstablishment() === $this) {$employee->setEstablishment(null);}}return $this;}public function getSubscription(): ?Subscription{return $this->subscriptions->last();}/*** @return Collection<int, Subscription>*/public function getSubscriptions(): Collection{return $this->subscriptions;}public function addSubscription(Subscription $subscription): self{if (!$this->subscriptions->contains($subscription)) {$this->subscriptions->add($subscription);$subscription->setEstablishment($this);}return $this;}public function removeSubscription(Subscription $subscription): self{if ($this->subscriptions->removeElement($subscription)) {// set the owning side to null (unless already changed)if ($subscription->getEstablishment() === $this) {$subscription->setEstablishment(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->add($order);$order->setEstablishment($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->getEstablishment() === $this) {$order->setEstablishment(null);}}return $this;}public function getConfiguration(): ?Configuration{return $this->configuration;}public function setConfiguration(Configuration $configuration): self{// set the owning side of the relation if necessaryif ($configuration->getEstablishment() !== $this) {$configuration->setEstablishment($this);}$this->configuration = $configuration;return $this;}public function getModel(): ?Model{return $this->model;}public function setModel(?Model $model): self{$this->model = $model;return $this;}/*** @return Collection<int, Menu>*/public function getMenus(): Collection{return $this->menus;}public function addMenu(Menu $menu): self{if (!$this->menus->contains($menu)) {$this->menus->add($menu);$menu->setEstablishment($this);}return $this;}public function removeMenu(Menu $menu): self{if ($this->menus->removeElement($menu)) {// set the owning side to null (unless already changed)if ($menu->getEstablishment() === $this) {$menu->setEstablishment(null);}}return $this;}public function getSlug(): ?string{return $this->slug;}public function setSlug(?string $slug): self{$this->slug = $slug;return $this;}public function checkSubscription(): null|Subscription{$last_subscription = $this->getSubscriptions()->last();if ($last_subscription && $last_subscription->getExpirationDays()) {return $last_subscription;}return null;}public function checkUserMember(User $user): bool|ReadableCollection{$isAdmin = $user === $this->getUser();return $isAdmin ??$this->getEmployees()->map(fn(Employee $e) => $user === $e->getUser()) ??$this->getInvitations()->map(fn(Invitation $i) => $user->getEmail() === $i->getEmail());}/*** @return Collection<int, QrCode>*/public function getQrCodes(): Collection{return $this->qrCodes;}public function addQrCode(QrCode $qrCode): static{if (!$this->qrCodes->contains($qrCode)) {$this->qrCodes->add($qrCode);$qrCode->setEstablishment($this);}return $this;}public function removeQrCode(QrCode $qrCode): static{if ($this->qrCodes->removeElement($qrCode)) {// set the owning side to null (unless already changed)if ($qrCode->getEstablishment() === $this) {$qrCode->setEstablishment(null);}}return $this;}/*** @return Collection<int, Bot>*/public function getBots(): Collection{return $this->bots;}public function addBot(Bot $bot): static{if (!$this->bots->contains($bot)) {$this->bots->add($bot);$bot->setEstablishment($this);}return $this;}public function removeBot(Bot $bot): static{if ($this->bots->removeElement($bot)) {// set the owning side to null (unless already changed)if ($bot->getEstablishment() === $this) {$bot->setEstablishment(null);}}return $this;}public function getRapportWallets(): array{$wallets = [];$this->departments->map(function (Department $department) use (&$wallets) {$wallets = array_merge($wallets, $department->getWallets());});return $wallets;}public function __toString(): string{return $this->name;}/*** @return Collection<int, Role>*/public function getRoleWorkers(): Collection{return $this->roleWorkers;}public function addRoleWorker(Role $roleWorker): static{if (!$this->roleWorkers->contains($roleWorker)) {$this->roleWorkers->add($roleWorker);$roleWorker->setEstablishment($this);}return $this;}public function removeRoleWorker(Role $roleWorker): static{if ($this->roleWorkers->removeElement($roleWorker)) {// set the owning side to null (unless already changed)if ($roleWorker->getEstablishment() === $this) {$roleWorker->setEstablishment(null);}}return $this;}/*** @return Collection<int, Advertisement>*/public function getAdvertisements(): Collection{return $this->advertisements;}public function addAdvertisement(Advertisement $advertisement): static{if (!$this->advertisements->contains($advertisement)) {$this->advertisements->add($advertisement);$advertisement->setEstablishment($this);}return $this;}public function removeAdvertisement(Advertisement $advertisement): static{if ($this->advertisements->removeElement($advertisement)) {// set the owning side to null (unless already changed)if ($advertisement->getEstablishment() === $this) {$advertisement->setEstablishment(null);}}return $this;}public function getRccm(): ?string{return $this->rccm;}public function setRccm(?string $rccm): static{$this->rccm = $rccm;return $this;}public function getIdNat(): ?string{return $this->idNat;}public function setIdNat(?string $idNat): static{$this->idNat = $idNat;return $this;}/*** @return Collection<int, Contract>*/public function getContracts(): Collection{return $this->contracts;}public function addContract(Contract $contract): static{if (!$this->contracts->contains($contract)) {$this->contracts->add($contract);$contract->setEstablishment($this);}return $this;}public function removeContract(Contract $contract): static{if ($this->contracts->removeElement($contract)) {// set the owning side to null (unless already changed)if ($contract->getEstablishment() === $this) {$contract->setEstablishment(null);}}return $this;}/*** @return Collection<int, Mutuality>*/public function getMutualities(): Collection{return $this->mutualities;}public function addMutuality(Mutuality $mutuality): static{if (!$this->mutualities->contains($mutuality)) {$this->mutualities->add($mutuality);$mutuality->setEstablishment($this);}return $this;}public function removeMutuality(Mutuality $mutuality): static{if ($this->mutualities->removeElement($mutuality)) {// set the owning side to null (unless already changed)if ($mutuality->getEstablishment() === $this) {$mutuality->setEstablishment(null);}}return $this;}/*** @return Collection<int, MutualityCategory>*/public function getMutualityCategories(): Collection{return $this->mutualityCategories;}public function addMutualityCategory(MutualityCategory $mutualityCategory): static{if (!$this->mutualityCategories->contains($mutualityCategory)) {$this->mutualityCategories->add($mutualityCategory);$mutualityCategory->setEstablishment($this);}return $this;}public function removeMutualityCategory(MutualityCategory $mutualityCategory): static{if ($this->mutualityCategories->removeElement($mutualityCategory)) {// set the owning side to null (unless already changed)if ($mutualityCategory->getEstablishment() === $this) {$mutualityCategory->setEstablishment(null);}}return $this;}/*** @return Collection<int, CardType>*/public function getCardTypes(): Collection{return $this->cardTypes;}public function addCardType(CardType $cardType): static{if (!$this->cardTypes->contains($cardType)) {$this->cardTypes->add($cardType);$cardType->setEstablishment($this);}return $this;}public function removeCardType(CardType $cardType): static{if ($this->cardTypes->removeElement($cardType)) {// set the owning side to null (unless already changed)if ($cardType->getEstablishment() === $this) {$cardType->setEstablishment(null);}}return $this;}/*** @return Collection<int, Gateway>*/public function getGateways(): Collection{return $this->gateways;}public function addGateway(Gateway $gateway): static{if (!$this->gateways->contains($gateway)) {$this->gateways->add($gateway);$gateway->setEstablishment($this);}return $this;}public function removeGateway(Gateway $gateway): static{if ($this->gateways->removeElement($gateway)) {// set the owning side to null (unless already changed)if ($gateway->getEstablishment() === $this) {$gateway->setEstablishment(null);}}return $this;}/*** @return Collection<int, Currency>*/public function getCurrencies(): Collection{return $this->currencies;}public function addCurrency(Currency $currency): static{if (!$this->currencies->contains($currency)) {$this->currencies->add($currency);$currency->setEstablishment($this);}return $this;}public function removeCurrency(Currency $currency): static{if ($this->currencies->removeElement($currency)) {// set the owning side to null (unless already changed)if ($currency->getEstablishment() === $this) {$currency->setEstablishment(null);}}return $this;}/*** @return Collection<int, ArticleDepartment>*/public function getArticleDepartments(): Collection{return $this->articleDepartments;}public function addArticleDepartment(ArticleDepartment $articleDepartment): static{if (!$this->articleDepartments->contains($articleDepartment)) {$this->articleDepartments->add($articleDepartment);$articleDepartment->setEstablishment($this);}return $this;}public function removeArticleDepartment(ArticleDepartment $articleDepartment): static{if ($this->articleDepartments->removeElement($articleDepartment)) {// set the owning side to null (unless already changed)if ($articleDepartment->getEstablishment() === $this) {$articleDepartment->setEstablishment(null);}}return $this;}public function getCurrencyDefault(){return $this->getCurrencies()->filter(fn(Currency $currency) => $currency->isIsDefault())->first();}/*** @return Collection<int, WalletOperation>*/public function getWalletOperations(): Collection{return $this->walletOperations;}public function addWalletOperation(WalletOperation $walletOperation): static{if (!$this->walletOperations->contains($walletOperation)) {$this->walletOperations->add($walletOperation);$walletOperation->setEstablishment($this);}return $this;}public function removeWalletOperation(WalletOperation $walletOperation): static{if ($this->walletOperations->removeElement($walletOperation)) {// set the owning side to null (unless already changed)if ($walletOperation->getEstablishment() === $this) {$walletOperation->setEstablishment(null);}}return $this;}}