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

Annotation support for Validator and DoctrineEntity element #69

Closed
bakura10 opened this issue Jul 8, 2012 · 8 comments
Closed

Annotation support for Validator and DoctrineEntity element #69

bakura10 opened this issue Jul 8, 2012 · 8 comments
Assignees

Comments

@bakura10
Copy link
Member

bakura10 commented Jul 8, 2012

Currently, when using Form annotation, there are no ways to specify the entity manager for Validator and DoctrineEntity Form elements. As the annotation builder has the em, I think it could be automatically injected ?

@Ocramius
Copy link
Member

Ocramius commented Jul 8, 2012

You'd build a new annotation builder. Specifying the entity manager to be used later on would be wrong.

@bakura10
Copy link
Member Author

bakura10 commented Jul 8, 2012

What ? There is already a specific annotation builder in DoctrineORMModule :).

@Ocramius
Copy link
Member

Ocramius commented Jul 8, 2012

Yes, but if you need a second EntityManager it is up to you to configure it with that, no?

@bakura10
Copy link
Member Author

bakura10 commented Jul 8, 2012

I don't want a second one. I just want one =).

@Ocramius
Copy link
Member

Ocramius commented Jul 8, 2012

So you basically want a setEntityManager on it?
Can you please elaborate your request a bit?

@bakura10
Copy link
Member Author

bakura10 commented Jul 8, 2012

Hmmm. Did you used the annotation form ? In fact, the NoEntityExists (as well as DoctrineORMModule\Form\Element\DoctrineEntity) needs an entity manager to work (otherwise they throw an exception).

However when using annotation, you cannot give instance to an option. BUT the Annotation builder in DoctrineORMModule (DoctrineORMModule\Form\Annotation\AnnotationBuilder) has an instance of the em. As this object checks every annotation to construct the form, it should be able to automatically inject the em to elements/validators that need it.

@Ocramius
Copy link
Member

Ocramius commented Jul 8, 2012

No, I didn't use the annotation builder, but the validators are something different from the builder itself. This anyway seems more like a job for the ElementAnnotationsListener (which should be instantiated with an EntityManager). My problem with all this stuff is that you're wiring it together :)
I don't really get how you would like these elements to be instantiated, but the EntityManager/ObjectManager should be explicitly set by the user in each case imo.

@ghost ghost assigned Ocramius Jul 13, 2012
@Ocramius
Copy link
Member

Ocramius commented Aug 1, 2012

Closing. This should be (imo) handled through metadata instead. Please re-open if you got better ideas to fix this, but I'd really move away from the concept of annotations and instead have a builder instantiated with an ObjectManager as parameter.

@Ocramius Ocramius closed this as completed Aug 1, 2012
oprokidnev pushed a commit to oprokidnev/DoctrineORMModule that referenced this issue Apr 19, 2016
[Hydrator] Allow hydration of existing objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants