S
S
slip312021-06-11 23:13:25
symfony
slip31, 2021-06-11 23:13:25

Why can't he see the mapping?

Hello.
I connected the doctrine to the project (I use only some components from Symfony, in particular the DI container)
in `index.php`

$loader->load(dirname(__DIR__). '/config/services.yml');

I connect the doctrine
doctrine.orm.config:
    public: true
    class: 'Doctrine\ORM\Configuration'
    factory:
      - 'Doctrine\ORM\Tools\Setup'
      - 'createXMLMetadataConfiguration'
    arguments:
      - [ '../src/Infrastructure/Persistence/Doctrine/Mapping/' ]
      - '%isDevMode%'
  doctrine.orm.entity_manager:
    public: true
    autowire: true
    class: 'Doctrine\ORM\EntityManager'
    factory:
      - 'Doctrine\ORM\EntityManager'
      - 'create'
    arguments:
      - driver: 'pdo_mysql'
        user: '%dbUser%'
        password: '%dbPassword%'
        dbname: '%dbName%'
      - '@doctrine.orm.config'

Accordingly, I have mapping here
` - [ '../src/Infrastructure/Persistence/Doctrine/Mapping/' ]`
and everything works fine until I tried to make a test. I made a test, included container compilation there
protected function setUp(): void
    {
        require_once __DIR__ . '/../../../vendor/autoload.php';
        $container = new ContainerBuilder();
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__));
        $loader->load(dirname(__DIR__). '/../../config/services.yml');
        $container->compile();
        $this->controller = $container->get('direction.web.controller');
    }

the config connects, but I get an error
No mapping file found named .... for class
For some reason, it does not see the entity mapping in the tests. Those. It doesn't work in tests, but it doesn't work in tests. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question