Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with my configuration because of an issue running orm:mapping:describe #97

Open
settermjd opened this issue Jan 30, 2023 · 1 comment

Comments

@settermjd
Copy link

settermjd commented Jan 30, 2023

I've followed the documentation, attempting to get Mezzio integrated with Doctrine, using this package, but keep encountering the following error, when running: php vendor/bin/doctrine orm:mapping:describe QuoteUser.

You do not have any mapped Doctrine ORM entities according to the current configuration. If you have entities or mapping files you should check your mapping configuration for errors.

I'm using roave/psr-container-doctrine 3.6.0 with PHP 8.1.14.

Here is my config/autoload/doctrine.global.php file:

<?php

use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Ramsey\Uuid\Doctrine\UuidType;
use Roave\PsrContainerDoctrine\EntityManagerFactory;

return [
    'dependencies' => [
        'factories' => [
            'doctrine.entity_manager.orm_default' => EntityManagerFactory::class,
        ],
    ],
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'params' => [
                    'url' => 'pgsql://user:password@database-test/developer_quotes_sender_test',
                ],
            ],
        ],
        'annotation' => [
            'metadata' => [
                'src/App/src/Entity',
            ],
        ],
        'entity_manager' => [
            'orm_default' => [
                'connection' => 'orm_default',
                'configuration' => 'orm_default',
            ],
        ],
        'driver' => [
            'orm_default' => [
                'class' => MappingDriverChain::class,
                'drivers' => [
                    'QuoteUser' => 'quote_user',
                ],
            ],
            'quote_user' => [
                'class' => AnnotationDriver::class,
                'cache' => 'array',
                'paths' => __DIR__ . '/../../src/App/src/Entity',
            ],
        ],
        'cache' => [
            'array' => [
                'class' => Doctrine\Common\Cache\ArrayCache::class,
                'namespace' => 'psr-container-doctrine',
            ],
        ],
        'types' => [
            UuidType::NAME => UuidType::class,
        ]
    ],
];

In src/App/src/Entity, i have one file named QuoteUser.php, with the following definition:

<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Doctrine\UuidGenerator;

/**
 * @ORM\Entity
 * @ORM\Table(name="quote_users")
 */
class QuoteUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="uuid", unique=true)
     * @ORM\GeneratedValue(strategy="CUSTOM")
     * @ORM\CustomIdGenerator(class=UuidGenerator::class)
     */
    private $userId;

    /** @ORM\Column(type="string",length="36",name="full_name") */
    private $fullName;

    /** @ORM\Column(type="string",length="18",name="mobile_number",unique="true") */
    private $mobileNumber;

    /** @ORM\Column(type="text",name="email_address",unique="true") */
    private $emailAddress;
}

This is the contents of cli-config.php:

<?php

use Doctrine\ORM\Tools\Console\ConsoleRunner;

$container = require 'config/container.php';

return ConsoleRunner::createHelperSet(
    $container->get('doctrine.entity_manager.orm_default')
);

Finally, I have the following factories element in config/autoload/dependencies.global.php:

'factories' => [
    // Fully\Qualified\ClassName::class => Fully\Qualified\FactoryName::class,
    ExecuteCommand::class => CommandFactory::class,
    ConfigurationLoader::class => ConfigurationLoaderFactory::class,
    DependencyFactory::class => DependencyFactoryFactory::class,
],
@settermjd settermjd changed the title Missing documentation Issues with my configuration because of an issue running orm:mapping:describe Jan 30, 2023
@settermjd
Copy link
Author

I've got a setup working with Slim. All being well, I'll figure out what I missed by comparison to that project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant