Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
| Snippet | |
0.00% |
0 / 7 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| testOnlyGetField | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getEntityNameForStorage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getEntityIdForStorage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Entity\Snippets; |
| 4 | |
| 5 | use Doctrine\ORM\Mapping as ORM; |
| 6 | use Olz\Entity\Common\DataStorageInterface; |
| 7 | use Olz\Entity\Common\DataStorageTrait; |
| 8 | use Olz\Entity\Common\OlzEntity; |
| 9 | use Olz\Entity\Common\TestableInterface; |
| 10 | use Olz\Repository\Snippets\SnippetRepository; |
| 11 | |
| 12 | #[ORM\Table(name: 'snippets')] |
| 13 | #[ORM\Entity(repositoryClass: SnippetRepository::class)] |
| 14 | class Snippet extends OlzEntity implements DataStorageInterface, TestableInterface { |
| 15 | use DataStorageTrait; |
| 16 | |
| 17 | #[ORM\Id] |
| 18 | #[ORM\Column(type: 'integer', nullable: false)] |
| 19 | private int $id; |
| 20 | |
| 21 | #[ORM\Column(type: 'text', nullable: true)] |
| 22 | private ?string $text; |
| 23 | |
| 24 | public function getId(): ?int { |
| 25 | return $this->id ?? null; |
| 26 | } |
| 27 | |
| 28 | public function setId(int $new_value): void { |
| 29 | $this->id = $new_value; |
| 30 | } |
| 31 | |
| 32 | public function getText(): ?string { |
| 33 | return $this->text; |
| 34 | } |
| 35 | |
| 36 | public function setText(?string $new_value): void { |
| 37 | $this->text = $new_value; |
| 38 | } |
| 39 | |
| 40 | // --- |
| 41 | |
| 42 | public function testOnlyGetField(string $field_name): mixed { |
| 43 | return $this->{$field_name}; |
| 44 | } |
| 45 | |
| 46 | public static function getEntityNameForStorage(): string { |
| 47 | return 'snippets'; |
| 48 | } |
| 49 | |
| 50 | public function getEntityIdForStorage(): string { |
| 51 | return "{$this->getId()}"; |
| 52 | } |
| 53 | } |