parent
77ca98dbcd
commit
7d38924dbd
@ -1,15 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace Rinsvent\RequestBundle\Service\Transformer; |
||||
|
||||
use Rinsvent\Data2DTO\Transformer\Meta; |
||||
|
||||
#[\Attribute] |
||||
class Entity extends Meta |
||||
{ |
||||
public const TYPE = 'service'; |
||||
|
||||
public function __construct( |
||||
public string $class |
||||
) {} |
||||
} |
@ -1,27 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace Rinsvent\RequestBundle\Service\Transformer; |
||||
|
||||
use Doctrine\ORM\EntityManagerInterface; |
||||
use Rinsvent\Data2DTO\Transformer\Meta; |
||||
use Rinsvent\Data2DTOBundle\Service\AbstractTransformer; |
||||
|
||||
class EntityTransformer extends AbstractTransformer |
||||
{ |
||||
public function __construct( |
||||
protected EntityManagerInterface $em |
||||
) {} |
||||
|
||||
/** |
||||
* @param $data |
||||
* @param Entity $meta |
||||
*/ |
||||
public function transform(&$data, Meta $meta): void |
||||
{ |
||||
if (!is_string($data)) { |
||||
return; |
||||
} |
||||
$repository = $this->em->getRepository($meta->class); |
||||
$data = $repository->find((string)$data); |
||||
} |
||||
} |
Loading…
Reference in new issue