-
Notifications
You must be signed in to change notification settings - Fork 230
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
Add compiler pass for bundles to register mappings #185
Conversation
public static function createAnnotationMappingDriver(array $namespaces, array $directories, $enabledParameter = false) | ||
{ | ||
$arguments = array(new Reference('doctrine_mongodb.odm.metadata.annotation_reader'), $directories); | ||
$locator = new Definition('Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator', $arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong (same than in the doctrineBundle)
StaticPHPDriver should also be supported (the whole driver lives in Common. The ORM only has a BC child class with no extra logic in it) |
Cross-referencing with the DoctrineBundle PR: doctrine/DoctrineBundle#177 |
i added support for php and staticphp drivers now by copying the definition creation code - its too small to make it worth to abstract it. this PR is now at the same state as the one on doctrine orm |
the doc PR about this is now merged: symfony/symfony-docs#2507 in doctrine/DoctrineBundle#177 i don't know if anything is still open or if its just not merged yet. tried to get the attention of stof and beberlei several times but they seem busy. |
doctrine orm is now merged too. anything left to do here? |
<?php | ||
|
||
/* | ||
* This file is part of the Doctrine Bundle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong
fixed the doc issue stof noticed, removed unnecessary |
* @param bool $enabledParameter if specified, the compiler pass only | ||
* executes if this parameter exists in the service container. | ||
*/ | ||
public function __construct($driver, $namespaces, $managerParameters, $enabledParameter = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think $namespaces
and $managerParameters
should be type-hinted, as in https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php#L83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update this.
great, thanks a lot. |
use the compiler pass added to the doctrine bridge to provide a nice compiler pass for bundles. See symfony/symfony#7599 and doctrine/DoctrineBundle#177
documentation PR is at symfony/symfony-docs#2507
this is used for example in FriendsOfSymfony/FOSUserBundle#1081