Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
| Textauswahlgruppe | |
0.00% |
0 / 20 |
|
0.00% |
0 / 9 |
182 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| addKind | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| getKinder | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLfdnr | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setName | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getVater | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setVater | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| removeKind | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Satag\AmicronEntityBundle\Entity; |
| 6 | |
| 7 | use Doctrine\Common\Collections\ArrayCollection; |
| 8 | use Doctrine\Common\Collections\Collection; |
| 9 | use Doctrine\DBAL\Types\Types; |
| 10 | use Doctrine\ORM\Mapping as ORM; |
| 11 | |
| 12 | /** |
| 13 | * @see \Satag\AmicronEntityBundle\Tests\Entity\TextauswahlgruppeTest |
| 14 | */ |
| 15 | #[ORM\Entity] |
| 16 | #[ORM\Table(name: 'TBGRUP')] |
| 17 | #[ORM\Index(columns: ['vaterlfdnr'], name: 'TBGRUP_VATERLFDNR_FK')] |
| 18 | class Textauswahlgruppe |
| 19 | { |
| 20 | /** |
| 21 | * @var Collection<int, Textauswahlgruppe> |
| 22 | */ |
| 23 | #[ORM\OneToMany(mappedBy: 'vater', targetEntity: Textauswahlgruppe::class, cascade: ['persist'])] |
| 24 | private Collection $kinder; |
| 25 | |
| 26 | #[ORM\Column(name: 'lfdnr', type: Types::INTEGER, nullable: false)] |
| 27 | #[ORM\Id] |
| 28 | #[ORM\GeneratedValue(strategy: 'SEQUENCE')] |
| 29 | #[ORM\SequenceGenerator(sequenceName: 'GEN_LFDNR', allocationSize: 1, initialValue: 1)] |
| 30 | public private(set) ?int $lfdnr = null; |
| 31 | |
| 32 | #[ORM\Column(name: 'gruppe', type: Types::STRING, length: 25, nullable: true)] |
| 33 | private ?string $name = null; |
| 34 | |
| 35 | #[ORM\ManyToOne(targetEntity: Textauswahlgruppe::class, cascade: ['persist'], inversedBy: 'kinder')] |
| 36 | #[ORM\JoinColumn(name: 'vaterlfdnr', referencedColumnName: 'lfdnr')] |
| 37 | private ?Textauswahlgruppe $vater = null; |
| 38 | |
| 39 | public function __construct( |
| 40 | ?string $name = null |
| 41 | ) { |
| 42 | if ($name !== null) { |
| 43 | $this->setName($name); |
| 44 | } |
| 45 | $this->kinder = new ArrayCollection(); |
| 46 | } |
| 47 | |
| 48 | public function addKind(self $gruppe): self |
| 49 | { |
| 50 | if (!$this->kinder->contains($gruppe)) { |
| 51 | $this->kinder->add($gruppe); |
| 52 | $gruppe->setVater($this); |
| 53 | } |
| 54 | |
| 55 | return $this; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * @return Collection<int, Textauswahlgruppe> |
| 60 | */ |
| 61 | public function getKinder(): Collection |
| 62 | { |
| 63 | return $this->kinder; |
| 64 | } |
| 65 | |
| 66 | public function getLfdnr(): ?int |
| 67 | { |
| 68 | return $this->lfdnr; |
| 69 | } |
| 70 | |
| 71 | public function getName(): ?string |
| 72 | { |
| 73 | return $this->name; |
| 74 | } |
| 75 | |
| 76 | public function setName(?string $name): self |
| 77 | { |
| 78 | $this->name = $name; |
| 79 | |
| 80 | return $this; |
| 81 | } |
| 82 | |
| 83 | public function getVater(): ?self |
| 84 | { |
| 85 | return $this->vater; |
| 86 | } |
| 87 | |
| 88 | public function setVater(?self $vater): self |
| 89 | { |
| 90 | if ($this !== $vater) { |
| 91 | $this->vater = $vater; |
| 92 | } |
| 93 | |
| 94 | return $this; |
| 95 | } |
| 96 | |
| 97 | public function removeKind(self $gruppe): self |
| 98 | { |
| 99 | if ($this->kinder->contains($gruppe)) { |
| 100 | $this->kinder->removeElement($gruppe); |
| 101 | $gruppe->setVater(null); |
| 102 | } |
| 103 | |
| 104 | return $this; |
| 105 | } |
| 106 | } |