ninecompta/src/Entity/Company.php

267 lines
5.7 KiB
PHP
Raw Normal View History

2024-11-18 17:07:22 +01:00
<?php
namespace App\Entity;
use App\Repository\CompanyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
2024-11-26 20:42:13 +01:00
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
2024-11-18 17:07:22 +01:00
#[ORM\Entity(repositoryClass: CompanyRepository::class)]
2024-11-26 20:42:13 +01:00
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_COMPANY', fields: ['title'])]
#[UniqueEntity(fields: ['email'], message: 'Ce nom de companie est déjà utilisé.')]
2024-11-18 17:07:22 +01:00
class Company
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
2024-11-26 20:42:13 +01:00
#[ORM\Column(length: 255, unique: true)]
2024-11-18 17:07:22 +01:00
private ?string $title = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $adress = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $logo = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankname = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankcode = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankguichet = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $banknum = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankkey = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $banklocality = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankiban = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankbic = null;
/**
* @var Collection<int, Accounting>
*/
#[ORM\OneToMany(targetEntity: Accounting::class, mappedBy: 'company', orphanRemoval: true)]
private Collection $accountings;
/**
* @var Collection<int, User>
*/
#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'companys')]
private Collection $users;
public function __construct()
{
$this->accountings = new ArrayCollection();
$this->users = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getAdress(): ?string
{
return $this->adress;
}
2024-11-21 08:32:59 +01:00
public function setAdress(?string $adress): static
2024-11-18 17:07:22 +01:00
{
$this->adress = $adress;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): static
{
$this->logo = $logo;
return $this;
}
public function getBankname(): ?string
{
return $this->bankname;
}
public function setBankname(?string $bankname): static
{
$this->bankname = $bankname;
return $this;
}
public function getBankcode(): ?string
{
return $this->bankcode;
}
public function setBankcode(?string $bankcode): static
{
$this->bankcode = $bankcode;
return $this;
}
public function getBankguichet(): ?string
{
return $this->bankguichet;
}
public function setBankguichet(?string $bankguichet): static
{
$this->bankguichet = $bankguichet;
return $this;
}
public function getBanknum(): ?string
{
return $this->banknum;
}
public function setBanknum(?string $banknum): static
{
$this->banknum = $banknum;
return $this;
}
public function getBankkey(): ?string
{
return $this->bankkey;
}
public function setBankkey(?string $bankkey): static
{
$this->bankkey = $bankkey;
return $this;
}
public function getBanklocality(): ?string
{
return $this->banklocality;
}
public function setBanklocality(?string $banklocality): static
{
$this->banklocality = $banklocality;
return $this;
}
public function getBankiban(): ?string
{
return $this->bankiban;
}
public function setBankiban(?string $bankiban): static
{
$this->bankiban = $bankiban;
return $this;
}
public function getBankbic(): ?string
{
return $this->bankbic;
}
public function setBankbic(?string $bankbic): static
{
$this->bankbic = $bankbic;
return $this;
}
/**
* @return Collection<int, Accounting>
*/
public function getAccountings(): Collection
{
return $this->accountings;
}
public function addAccounting(Accounting $accounting): static
{
if (!$this->accountings->contains($accounting)) {
$this->accountings->add($accounting);
$accounting->setCompany($this);
}
return $this;
}
public function removeAccounting(Accounting $accounting): static
{
if ($this->accountings->removeElement($accounting)) {
// set the owning side to null (unless already changed)
if ($accounting->getCompany() === $this) {
$accounting->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): static
{
if (!$this->users->contains($user)) {
$this->users->add($user);
$user->addCompany($this);
}
return $this;
}
public function removeUser(User $user): static
{
if ($this->users->removeElement($user)) {
$user->removeCompany($this);
}
return $this;
}
}