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

Possible bug in Admingenerator\GeneratorBundle\DependencyInjection\AdmingeneratorGeneratorExtension::registerFormsServicesFromGenerator #288

Closed
TheCelavi opened this issue May 31, 2016 · 6 comments
Labels

Comments

@TheCelavi
Copy link
Contributor

Every auto-generated form is registered in: Admingenerator\GeneratorBundle\DependencyInjection\AdmingeneratorGeneratorExtension::registerFormsServicesFromGenerator

Pattern is:

$container->setDefinition('admingen_generator_' . strtolower($model) . '_edit', $editDefinition);

Note that _edit can be _new and _filter as well.

strtolower($model) is used, and model is class name without namespace prefix.

That means that, per example, classes:

  • \One\ModelX
  • \Two\ModelX

Would have generated form type service under the same name:

  • admingen_generator_modelx_edit, and so on...

That means that in case when we have models with same name under different namespaces, form type services gets overridden.

This is easy fix, can someone confirm this, just another pair of eyes, in case I am missing something?

@ioleo
Copy link
Member

ioleo commented May 31, 2016

@TheCelavi yes, this is obviously a bug, could you submit a PR to fix it?
However, changeing the service names would introduce BC break to anyone already useing these forms (@sescandell ? ). We should also provide an alias (old service name) to the first/latest defininion (whichever was in current behaviour).

@ioleo ioleo added the bug label May 31, 2016
@TheCelavi
Copy link
Contributor Author

Of course, assign it to me. Agree with alias.

Should I update this file

https://github.com/symfony2admingenerator/GeneratorBundle/blob/master/UPGRADE.MD

with info as well, is there any log in which change should be noted?

@ioleo ioleo assigned ioleo and unassigned ioleo May 31, 2016
@ioleo
Copy link
Member

ioleo commented May 31, 2016

There is no changelog, only what you mentioned - upgrade notes.

TheCelavi added a commit to RunOpenCode/GeneratorBundle that referenced this issue May 31, 2016
…unique service name, no possibility for overwritting.
TheCelavi added a commit to RunOpenCode/GeneratorBundle that referenced this issue May 31, 2016
…unique service name, no possibility for overwritting.
ioleo pushed a commit that referenced this issue May 31, 2016
@sescandell
Copy link
Member

Good one! Thanks @TheCelavi

However, changeing the service names would introduce BC break to anyone already useing these forms (@sescandell ? ).

Tru... but I'm not sure actually people use the service name itself: they are not necessary anymore if I'm not wrong... actually... not sure about that...

@TheCelavi
Copy link
Contributor Author

@sescandell If someone used compiler pass to add additional dependencies to generated form type service (as we used to do so), new name without alias would be a BC break.

I don't know what is your practice in development, but I have added TODO comment as reminder for alias to be removed in next major release when BC breaks are allowed.

@sescandell
Copy link
Member

@TheCelavi 👍

@ioleo ioleo closed this as completed in c74f76c Jun 2, 2016
ioleo pushed a commit that referenced this issue Jun 2, 2016
Fixed #288, auto generated form types now have unique service name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants