This is my full config to initializer Dcotrine:
$connParams = array(
'driver' => 'pdo_pgsql',
'host' => 'xxxx',
'dbname' => 'myddb',
'user' => 'yyyy',
'password' => 'xxxxxx',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
);
$db = \Doctrine\DBAL\DriverManager::getConnection($connParams);
$db->executeQuery("SET datestyle TO ISO;");
$db->executeQuery("SET lc_messages TO 'C';");
$config = Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(
array(__DIR__.'/modules/core/src/php/tvip/core/model'), true);
$em = Doctrine\ORM\EntityManager::create($db, $config);
I have discovered that Doctrine\ORM\Tools\Setup::
createAnnotationMetadataConfiguration will call newDefaultAnnotationDriver()
which should register Doctrine annotations by itself by calling
AnnotationRegistry::registerFile(__DIR__ .
'/Mapping/Driver/DoctrineAnnotations.php');
I have added:
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(function($cl
){
echo '==='.$cl.PHP_EOL;
});
And the result is:
===Doctrine\ORM\Mapping\ORM\Table
===Doctrine\ORM\Mapping\ORM\Entity
instead of
===Doctrine\ORM\Mapping\Table
===Doctrine\ORM\Mapping\Entity
суббота, 6 декабря 2014 г., 12:36:11 UTC+3 пользователь Pavel Sokolov
написал:
>
> I have added this line, but it is still not works:
>
> \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(__DIR__.
> '/lib/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
> );
>
>
>
> воскресенье, 30 ноября 2014 г., 15:21:50 UTC+3 пользователь Holtkamp
> написал:
>>
>> No, you need to register the Doctrine ORM namespace (the one that
>> contains the annotations)
>>
>> Cheers!
>> On Nov 30, 2014 10:47 AM, "Pavel Sokolov" <[email protected]> wrote:
>>
>>> I have tried to use callback:
>>>>
>>>> \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(
>>>> function($class) {
>>>> echo 'TEST:'.$class.PHP_EOL;
>>>> });
>>>>
>>>>
>>>> I see the next result:
>>>> TEST: Doctrine\ORM\Mapping\ORM\Table
>>>> TEST: Doctrine\ORM\Mapping\ORM\Entity
>>>>
>>>>
>>>> But seems that it should look like this:
>>>> TEST: Doctrine\ORM\Mapping\Table
>>>> TEST: Doctrine\ORM\Mapping\Entity
>>>>
>>>>
>>>> May be it is bug in doctrine?
>>>>
>>> -
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "doctrine-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/doctrine-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.