first commit
This commit is contained in:
176
src/Entity/Accounting.php
Normal file
176
src/Entity/Accounting.php
Normal file
@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\AccountingRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: AccountingRepository::class)]
|
||||
class Accounting
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $num01 = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $num02 = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $title = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $actif = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'accountings')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Company $company = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Operation>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Operation::class, mappedBy: 'credit', orphanRemoval: true)]
|
||||
private Collection $credits;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Operation>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Operation::class, mappedBy: 'debit', orphanRemoval: true)]
|
||||
private Collection $debits;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->credits = new ArrayCollection();
|
||||
$this->debits = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getNum01(): ?string
|
||||
{
|
||||
return $this->num01;
|
||||
}
|
||||
|
||||
public function setNum01(string $num01): static
|
||||
{
|
||||
$this->num01 = $num01;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNum02(): ?string
|
||||
{
|
||||
return $this->num02;
|
||||
}
|
||||
|
||||
public function setNum02(string $num02): static
|
||||
{
|
||||
$this->num02 = $num02;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle(string $title): static
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActif(): ?bool
|
||||
{
|
||||
return $this->actif;
|
||||
}
|
||||
|
||||
public function setActif(bool $actif): static
|
||||
{
|
||||
$this->actif = $actif;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCompany(): ?Company
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
public function setCompany(?Company $company): static
|
||||
{
|
||||
$this->company = $company;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Operation>
|
||||
*/
|
||||
public function getCredits(): Collection
|
||||
{
|
||||
return $this->credits;
|
||||
}
|
||||
|
||||
public function addCredit(Operation $credit): static
|
||||
{
|
||||
if (!$this->credits->contains($credit)) {
|
||||
$this->credits->add($credit);
|
||||
$credit->setCredit($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCredit(Operation $credit): static
|
||||
{
|
||||
if ($this->credits->removeElement($credit)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($credit->getCredit() === $this) {
|
||||
$credit->setCredit(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Operation>
|
||||
*/
|
||||
public function getDebits(): Collection
|
||||
{
|
||||
return $this->debits;
|
||||
}
|
||||
|
||||
public function addDebit(Operation $debit): static
|
||||
{
|
||||
if (!$this->debits->contains($debit)) {
|
||||
$this->debits->add($debit);
|
||||
$debit->setDebit($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeDebit(Operation $debit): static
|
||||
{
|
||||
if ($this->debits->removeElement($debit)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($debit->getDebit() === $this) {
|
||||
$debit->setDebit(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
263
src/Entity/Company.php
Normal file
263
src/Entity/Company.php
Normal file
@ -0,0 +1,263 @@
|
||||
<?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;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CompanyRepository::class)]
|
||||
class Company
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
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;
|
||||
}
|
||||
|
||||
public function setAdress(string $adress): static
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
98
src/Entity/Operation.php
Normal file
98
src/Entity/Operation.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\OperationRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: OperationRepository::class)]
|
||||
class Operation
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $title = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date = null;
|
||||
|
||||
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2)]
|
||||
private ?string $montant = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'credits')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Accounting $credit = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'debits')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Accounting $debit = null;
|
||||
|
||||
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 getDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
public function setDate(\DateTimeInterface $date): static
|
||||
{
|
||||
$this->date = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMontant(): ?string
|
||||
{
|
||||
return $this->montant;
|
||||
}
|
||||
|
||||
public function setMontant(string $montant): static
|
||||
{
|
||||
$this->montant = $montant;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCredit(): ?Accounting
|
||||
{
|
||||
return $this->credit;
|
||||
}
|
||||
|
||||
public function setCredit(?Accounting $credit): static
|
||||
{
|
||||
$this->credit = $credit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDebit(): ?Accounting
|
||||
{
|
||||
return $this->debit;
|
||||
}
|
||||
|
||||
public function setDebit(?Accounting $debit): static
|
||||
{
|
||||
$this->debit = $debit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
145
src/Entity/User.php
Normal file
145
src/Entity/User.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\UserRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_USERNAME', fields: ['username'])]
|
||||
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 180)]
|
||||
private ?string $username = null;
|
||||
|
||||
/**
|
||||
* @var list<string> The user roles
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private array $roles = [];
|
||||
|
||||
/**
|
||||
* @var string The hashed password
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $password = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Company>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Company::class, inversedBy: 'users')]
|
||||
private Collection $companys;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->companys = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUsername(): ?string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function setUsername(string $username): static
|
||||
{
|
||||
$this->username = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A visual identifier that represents this user.
|
||||
*
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getUserIdentifier(): string
|
||||
{
|
||||
return (string) $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getRoles(): array
|
||||
{
|
||||
$roles = $this->roles;
|
||||
// guarantee every user at least has ROLE_USER
|
||||
$roles[] = 'ROLE_USER';
|
||||
|
||||
return array_unique($roles);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $roles
|
||||
*/
|
||||
public function setRoles(array $roles): static
|
||||
{
|
||||
$this->roles = $roles;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PasswordAuthenticatedUserInterface
|
||||
*/
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(string $password): static
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function eraseCredentials(): void
|
||||
{
|
||||
// If you store any temporary, sensitive data on the user, clear it here
|
||||
// $this->plainPassword = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Company>
|
||||
*/
|
||||
public function getCompanys(): Collection
|
||||
{
|
||||
return $this->companys;
|
||||
}
|
||||
|
||||
public function addCompany(Company $company): static
|
||||
{
|
||||
if (!$this->companys->contains($company)) {
|
||||
$this->companys->add($company);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCompany(Company $company): static
|
||||
{
|
||||
$this->companys->removeElement($company);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user