Отладка библиотек

master
Rinsvent 3 years ago
parent 77ca98dbcd
commit 7d38924dbd
  1. 1
      src/DependencyInjection/RequestExtension.php
  2. 7
      src/Resources/config/services.yaml
  3. 15
      src/Service/Transformer/Entity.php
  4. 27
      src/Service/Transformer/EntityTransformer.php

@ -2,7 +2,6 @@
namespace Rinsvent\RequestBundle\DependencyInjection; namespace Rinsvent\RequestBundle\DependencyInjection;
use Rinsvent\RequestBundle\Service\Transformer\AbstractTransformer;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\Extension;

@ -7,10 +7,3 @@ services:
Rinsvent\RequestBundle\EventListener\RequestListener: Rinsvent\RequestBundle\EventListener\RequestListener:
tags: tags:
- { name: kernel.event_listener, event: kernel.request } - { name: kernel.event_listener, event: kernel.request }
Rinsvent\RequestBundle\Service\Transformer\:
resource: '../../../src/Service/Transformer'
_instanceof:
Rinsvent\Data2DTOBundle\Service\AbstractTransformer:
tags: [ 'rinsvent.transformer' ]

@ -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…
Cancel
Save