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

Creating a branch using Doctrine Common 3.0.x #54

Closed
stof opened this issue May 22, 2011 · 9 comments
Closed

Creating a branch using Doctrine Common 3.0.x #54

stof opened this issue May 22, 2011 · 9 comments

Comments

@stof
Copy link
Contributor

stof commented May 22, 2011

The 3.0.x branch of Doctrine Common changes the way annotations are handled. Symfony switches to this branch today which means that your extension will not work anymore (having 2 versions of the Common library is not possible).

@l3pp4rd
Copy link
Contributor

l3pp4rd commented May 22, 2011

hi, are there any docs on syntax changes, behavior or something? I would not like to create another branch :)

@stof
Copy link
Contributor Author

stof commented May 22, 2011

The issue is that the way to configure the reader changed. As you configure it inside the library instead of injecting it, the place where you register it needs to be changed. For instance, there is no changes in the ORM itself as the configuration of the driver is not done in the ORM but before injecting the driver (so the change is in the ORM config for each user).
And then, the change is needed in the classes where annotations are used but this is for each user when updating.

@schmittjoh
Copy link

I haven't used this library, but it would be good if you would allow people to inject the annotation reader that they want to use to benefit from caching and not having annotations read multiple times by different readers.

@l3pp4rd
Copy link
Contributor

l3pp4rd commented May 22, 2011

I see that new reader breaks BC for ORM since Doctrine\ORM\Configuration::newDefaultAnnotationDriver() will fail to initialize by calling unidentified method: setDefaultAnnotationNamespace is everyone OK with that? I understand that symfony2 does not use this method to create driver chain and so on, but it leaves a hole since ORM provides this method.

Is it possible to add namespace alias, like before, if yes, how can I do it?

@stof
Copy link
Contributor Author

stof commented May 22, 2011

You don't add namespace aliases. The annotations depends of the use statement. This is the way to do to keep the annotations separated from others:

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */

@stof
Copy link
Contributor Author

stof commented May 22, 2011

And with the new implementation, you don't need to add a new annotation reader. You can simply reuse the same. And this is another reason why allowing to inject the reader would be a good idea: Sf2 now uses a single annotation reader for all parts of the framework, so annotations are parsed only once and then cached and used by all services needing them.

@l3pp4rd
Copy link
Contributor

l3pp4rd commented May 22, 2011

@schmittjoh have you tested it? I'm trying a simple reading of annotations and $reader->getClassAnnotations($class); returns numerically indexed array of annotations found. The problem is ORM depends on class name as a key of each array element. Am I missing something? using ORM from master branch and common3.0.x branch..

@schmittjoh
Copy link

If you rely on indexes you need to use the "IndexedReader" which is in the
DoctrineBundle.

On Sun, May 22, 2011 at 6:14 PM, l3pp4rd <
reply@reply.github.com>wrote:

@schmittjoh have you tested it? I'm trying a simple reading of annotations
and $reader->getClassAnnotations($class); returns numerically indexed
array of annotations found. The problem is ORM depends on class name as a
key of each array element. Am I missing something? using ORM from master
branch and common3.0.x branch..

Reply to this email directly or view it on GitHub:
https://github.com/l3pp4rd/DoctrineExtensions/issues/54#comment_1217682

@l3pp4rd
Copy link
Contributor

l3pp4rd commented May 22, 2011

@stof I have currently made annotation reader injectable to the listener, can you test if it is compatible? since the namespace alias will not be available anymore, the documentation should be also available for symfony2 usage

greg0ire pushed a commit to greg0ire/DoctrineExtensions that referenced this issue Jan 27, 2024
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

3 participants