Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| EntityReferenceTransformer | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Engine\Application\Transformer; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Core\Engine\Domain\Model\FieldMetadata; |
| 12 | |
| 13 | /** |
| 14 | * Entity Reference (FK) UiType Transformer. |
| 15 | * |
| 16 | * Handles UiType: entity_reference. |
| 17 | * Read: displays the pre-resolved label from the LEFT JOIN alias |
| 18 | * (e.g., rel_{field_key}.{relation_label} AS {field_key}_label). |
| 19 | * Falls back to the raw FK integer value if no label is available. |
| 20 | * Write: casts to int for FK storage. |
| 21 | * |
| 22 | * @package App\Core\Engine\Application\Transformer |
| 23 | */ |
| 24 | final class EntityReferenceTransformer extends AbstractIntegerReferenceTransformer |
| 25 | { |
| 26 | /** {@inheritdoc} */ |
| 27 | public function supports(string $uitypeName): bool |
| 28 | { |
| 29 | return $uitypeName === 'entity_reference'; |
| 30 | } |
| 31 | } |