-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
How do you migrate from doctrine-orm-module 1 to 4, wrt. annotations? #716
Comments
@jarrettj Could you please post the entity with its annotation here? Otherwise, it will be hard to guess what could be the issue. It looks like you are having some custom |
Hi, Good day. All our entities extends from a base class that simply has the following:
Another thing I have noticed is that ManyToMany relationships are also not detected anymore. All other fields Work though. Example ManyToMany:
Also, regarding the Guid annotation, I have not yet figured out how to add those as it was before. Since we can no onger extend Laminas\Form\Annotation\AnnotationBuilder. This means I can't do the following:
First wanted to figure out why the 'id' and ManyToMany fields are not seen anymore. Thank you very much for the quick response and apologise for my delay. Regards. |
Let's start with the annotations first. Earlier versions of DoctrineORMModule (<4.0) used an annotation parsing engine from laminas-code, which was removed with release 4.0.0 of laminas-code. Therefore, we switched to a different annotation parsing engine provided by doctrine/annotations. In most cases, the annotations (i.e. the comment in the docblock section) can remain the same. However, the annotation class itself might need a little adjustment in regard to its contructor arguments, if the annotation is supposed to have arguments. That was why I asked for the code of your annotation class. If you have an annotation Now with doctrine/annotations (in contrast to laminas-form!) you do not need to register each annotation class with the parser, so your However, the annotation itself just provides the data, there should be some code in your application which actually handles the annotation. In 1.x, 2.x and 3.x this was done with the class Register your custom listener as follows: $formBuilder = new EntityBasedFormBuilder($this->entityManager);
$customEventListener = new CustomEventListener(...);
$formBuilder->getBuilder()->attach($customEventListener); Afterwards, you can call Regarding your issue with the |
Builder.php https://pastebin.com/znRySF40 Added the one custom annotation as the others would follow the same setup. Previously we retrieved the Builder using the serviceLocator, but that's been deprecated:
My assumption is that I should instead inject the builder into my Controller class via its Factory class:
The creation of AppAnnotationBuilder is in module/Application/config/module.config.php:
Not using AppListener, as you detailed, the registration of custom annotations have changed. I tried to use CustomEventListener, but that class does not exist in my project. How do you install that? My current composer.json:
I might be missing a doctrine module I guess? My mapped superclass would be the one specified in the response above 'class Entity'. In which the 'id' of all extending Entities should derive from. An example would be Phase:
Thanks for the help thus far. Regards. |
Hey,
Good day.
We currently having issues with the doctrine EntityBasedFormBuilder. This is our current setup:
The bits I am not sure of is why my ‘id’ no longer works for an existing entity? I get the following message:
composer.json
Any help would be much appreciated. Thanks.
Regards,
Jarrett
The text was updated successfully, but these errors were encountered: