symfony2admingenerator / GeneratorBundle

Admingenerator for Symfony. Parse YAML files to build customized backend.
MIT License
67 stars 29 forks source link

Authorisation checker not passed to FormType, BC break #254

Closed TheCelavi closed 8 years ago

TheCelavi commented 8 years ago

BC break introduced, here is an example:

protected function getNewType()
{
    return '{{ builder.formType }}';
}

in vendor/symfony2admingenerator/generator-bundle/Resources/templates/CommonAdmin/NewAction/NewBuilderAction.php.twig

So if generator.yml uses authorisation checker, we get null pointer exception.

That means that every type should be registered to service container with setter method for required dependency.

Maybe this can be optimised to avoid boilerplate?

TheCelavi commented 8 years ago

I have investigated service container, forms are registered as service, but it seams that they are not registered with form.type tag..?

TheCelavi commented 8 years ago

False alarm - me being stupid, again, nothing new...

sescandell commented 8 years ago

Hi @TheCelavi

Yes forms are registered as services since #224

And yes they are tagged: https://github.com/symfony2admingenerator/GeneratorBundle/blob/master/DependencyInjection/AdmingeneratorGeneratorExtension.php#L280

TheCelavi commented 8 years ago

Which is awesome!

But it is a BC break, because previously we got the instances in Controller, so we injected into instances additional services, if needed.

This is not something HUGE to make it compatible, however, it is a BC break.

Seriously, you should REALY consider having BC break list :)

I have to fork this, at least I can contribute with documentation...

sescandell commented 8 years ago

Actually, until now, the bundle was not under a "stable" release, and many BC Breaks have been made to be 2.8+ compliant, and not all of them have been identified, that's true, and I'm sorry for that. But going to a stable release was a priority.

Now we started to release the bundle, we'll take care about BC Breaks.

Documentation is a WIP, any help is welcome :)