Lines
100.00%
14 / 14
Functions and Methods
100.00%
3 / 3
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Source | 100.00% | 14 / 14 | 100.00% | 3 / 3 | 3 | 100.00% | 1 / 1 | |||
| getEntityMapping | 100.00% | 8 / 8 | 100.00% | 1 / 1 | 1 | |||||
| addConditionSource | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | |||||
| postProcess | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace BO\Zmsbackend\Source\Repository; | |
| 4 | ||
| 5 | class Source extends \BO\Zmsbackend\Query\Base implements \BO\Zmsbackend\Query\MappingInterface | |
| 6 | { | |
| 7 | /** | |
| 8 | * @var String TABLE mysql table reference | |
| 9 | */ | |
| 10 | const string TABLE = 'source'; | |
| 11 | ||
| 12 | /** | |
| 13 | * @return string[] | |
| 14 | * | |
| 15 | */ | |
| 16 | #[\Override] | |
| 17 | public function getEntityMapping() | |
| 18 | { | |
| 19 | return [ | |
| 20 | 'source' => 'source.source', | |
| 21 | 'label' => 'source.label', | |
| 22 | 'editable' => 'source.editable', | |
| 23 | 'contact__name' => 'source.contact__name', | |
| 24 | 'contact__email' => 'source.contact__email', | |
| 25 | 'lastChange' => 'source.lastChange', | |
| 26 | ]; | |
| 27 | } | |
| 28 | ||
| 29 | public function addConditionSource($source): static | |
| 30 | { | |
| 31 | $this->query->where('source.source', '=', $source); | |
| 32 | return $this; | |
| 33 | } | |
| 34 | ||
| 35 | #[\Override] | |
| 36 | public function postProcess($data) | |
| 37 | { | |
| 38 | $data[$this->getPrefixed("lastChange")] = | |
| 39 | (new \DateTime($data[$this->getPrefixed("lastChange")] . \BO\Zmsbackend\Connection\Select::$connectionTimezone)) | |
| 40 | ->getTimestamp(); | |
| 41 | return $data; | |
| 42 | } | |
| 43 | } |