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

Abstract and Parent aren't supported #15

Open
philippecarle opened this issue Nov 17, 2015 · 3 comments
Open

Abstract and Parent aren't supported #15

philippecarle opened this issue Nov 17, 2015 · 3 comments

Comments

@philippecarle
Copy link

I'll try to create a PR in the next days, but just to warn every developers using this SO useful bundle (I just migrated a whole project to xml, it saved my life) :
abstract: true and parent:… are not supported and won't be converted

A routing converter would be great too, I wrote something which was ok for my use, but it'd worth to be shared and optimized.

Once again, thx !

@rosstuck
Copy link
Owner

Hmm, this bundle is based on the actual Symfony converters and dumpers so they should be supported.

Are the parent definitions in the same file you're importing? Just curious.

@philippecarle
Copy link
Author

Yes they are. Here is the example :

    my_project.jms_repository:
        class: Vendor\Segment\MyBundle\Repository\JMSRepository
        abstract: true
        calls:
            - [ setSerializer, [ @jms_serializer ] ]
    my_project.my_repository:
        class: Vendor\Segment\MyBundle\Repository\MyRepository
        factory_service: doctrine.orm.entity_manager
        factory_method:  getRepository
        arguments:
            - "MyBundle:MyEntity"
        parent:
            my_project.jms_repository

@rosstuck
Copy link
Owner

Hi @philippecarle, I dug into this a little further. It seems the issue is upstream in Symfony.

This bundle just wires the Symfony Loaders directly into the Dumpers. However, after a cursory inspect, it seems the Dumpers don't have any support for abstract or parent definitions. That's not to say it's impossible, I don't see any tests for the feature either, so it could have been simply forgotten but there might be an underlying technical reason.

For example, take a look at https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php#L60. The abstract and parent flags are just never printed. Abstract can be added with $definition->isAbstract() but I'm not sure how to go about the parent definition, at a glance.

Fixing this goes beyond the scope of this bundle and needs to be taken up into Symfony core. though it needs to be done for each of the dumpers and have tests added.

I don't have time to do this myself right now but perhaps it would be good idea to open a bug on Symfony and get some feedback on the technical feasibility. We can then decide what the best course of action is. If you'd like to open that bug, can you include a link to this issue so I can keep track of it? :)

Thanks a ton for taking the time to report this and include an example, I really appreciate it!

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

2 participants