1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace App\Entity;
use App\Flux\AccountableInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity()
* @ORM\Table(name="account_groupe", uniqueConstraints={@ORM\UniqueConstraint(name="groupecurrency", columns={"groupe_id", "currency"})}) )
* @UniqueEntity(
* fields={"groupe", "currency"},
* errorPath="groupe",
* message="Le compte du groupe existe déjà."
* )
*/
class AccountGroupe extends Account
{
/**
* @ORM\ManyToOne(targetEntity=Groupe::class, inversedBy="accounts", cascade={"persist", "remove"})
* @ORM\JoinColumn(name="groupe_id", referencedColumnName="id", nullable=false)
*/
private $groupe;
/**
* @var ArrayCollection|OperationGroupe[]
* @ORM\OneToMany(targetEntity=OperationGroupe::class, mappedBy="account")
*/
protected $operations;
public function __construct()
{
$this->operations = new ArrayCollection();
}
public function getGroupe(): ?Groupe
{
return $this->groupe;
}
public function setGroupe(Groupe $groupe): self
{
$this->groupe = $groupe;
return $this;
}
public function setAccountableObject(AccountableInterface $object): self
{
return $this->setGroupe($object);
}
public function getAccountableObject(): AccountableInterface
{
return $this->getGroupe();
}
}