Giter VIP home page Giter VIP logo

Comments (13)

stof avatar stof commented on July 18, 2024

The annotation_reader service is defined by FrameworkBundle. Did you disable it ?

from doctrinebundle.

 avatar commented on July 18, 2024

Oh I see, I guess that fixes this problem :)

But it seems like a strange dependency for DoctrineBundle as it's making the assumption that one wants to use FrameworkBundle. DoctrineBundle really should be free of a dependency like that IMO.

Thanks for you help, the issue fixed for me.

from doctrinebundle.

stof avatar stof commented on July 18, 2024

@Drak the dependency to FrameworkBundle is documented in the composer.json file. And I don't see why DoctrineBundle should redefine its own annotation reader. It would kill performances by parsing the annotations several times if another bundle also uses annotations in your entity (the validation for instance).
Thus, FrameworkBundle is the root of the Symfony framework. Without it, it means you are not using the framework. So I don't think trying to get rid of this dependency makes sense.

from doctrinebundle.

 avatar commented on July 18, 2024

@stof - FrameworkBundle is the foundation of the Symfony2 Framework, but the bundle system is part of HttpKernel component and is a feature of that component - not the FrameworkBundle (and therefor not Symfony2 Framework). I don't need, nor should need FrameworkBundle to use the bundle system. I understand that Doctrine Common's features are being used by FrameworkBundle, that makes perfect sense, but since the dependency is on Doctrine Common, we should not be forced to use FrameworkBundle just to use DoctrineBundle.

I understand the history of this because of course, DoctrineBundle was until recently in the Symfony2 repo and was more tightly integrated but now.

One problem with the bundle system is that you're forced to accept all services and listeners it might add, and that is a real problem, it's not like I can just add FrameworkBundle just for the annotations reader because I get a million other things I don't want or need in my application - if I was using FrameworkBundle, great, but not in this case. Nor is there a way to configure a bundle's DI-extension to just load some things. As such, it's not like adding a library where you just use what you need and leave the rest alone bundles are all or nothing - and if it's a large bundle that becomes problematic.

The fact remains that bundles are the heart of HttpKernel, not FrameworkBundle and therefor it's unreasonable to force FrameworkBundle on every application (it seems very anti-Symfony flexibility paradigm too).

Doctrine Common provides some very useful things across the board, and maybe it's time there was a DoctrineCommonBundle which provided the services of Doctrine Common for use by other bundles that need things like the annotations reader.

I'm willing to put in the time and effort, I'm not just complaining and hoping someone else will do the work :-)

from doctrinebundle.

lsmith77 avatar lsmith77 commented on July 18, 2024

@Drak no the Bundle system was designed for the Symfony2 full stack framework. now you are starting to use them outside of Symfony2 full stack, which is fine, but doesn't change the target audience.

now for the issue at hand, the dependencies are clearly defined in the composer.json. if you don't like them, then you can override them with what composer offers you. for example you can create your own FrameworkBundle that just defines the annotation reader.

i don't see any feasible alternative. we cannot create a dedicated Bundle for every service and we can also not create a configuration option for every service provided by a Bundle. so again, if you want to repurpose Symfony2 Bundles that is fine, but you then either have to accept the services they come with, the dependencies on other Bundles or override those Bundles to just define the services you need (though this can of course break without warning in updates).

from doctrinebundle.

 avatar commented on July 18, 2024

@lsmith77 - Sorry but the bundles framework is part of the HttpKernel component and the related components (like DI, Event Dispatcher) , but not other bundles. This shows that bundles revolve around the HttpKernel component and not FrameworkBundle which is just a framework implementation.

It just happens that Symfony2's full stack framework revolves around FrameworkBundle and so people are making some bundles for it which is all fine and OK, but not for something like Doctrine Common annotations library which could be used by anything, even as far removed including CLI commands.

from doctrinebundle.

lsmith77 avatar lsmith77 commented on July 18, 2024

yes the Bundle concept is part of HttpKernel. but the Bundles you are trying to use are build for Symfony2 full stack.

what do you propose as an alternative here? an AnnotationBundle?

from doctrinebundle.

 avatar commented on July 18, 2024

@lsmith77 - yes something like that, and if Doctrine has more goodies in it, maybe a DoctrineCommon bundle? I would be willing to make the effort. It's just a matter of tweaking composer manifests too and everything will fit nicely together.

from doctrinebundle.

lsmith77 avatar lsmith77 commented on July 18, 2024

and where does it end? should the kernel listeners also get their own Bundle? etc.

from doctrinebundle.

 avatar commented on July 18, 2024

@lsmith77 - Of course not - that is confusing the issue. Annotations are a base library that is needed by anything requiring annotations, it's quite a different matter entirely. DoctrineBundle is relying on getting the annotations reader from a bundle that really has no business providing it. Since Annotations are part of Doctrine Common wouldn't it be more logical and better to have it as part of DoctrineBundle or a DoctrineCommon bundle? That way FrameworkBundle can rely on DoctrineCommonBundle and the annotations service would be available in other contexts too.

from doctrinebundle.

lsmith77 avatar lsmith77 commented on July 18, 2024

i dont see an inherit logic. the level of granularity seems arbitrary to me. the question is more exactly how much Symfony2 fullstack Bundle devs should care about non fullstack users.

the risk is as we split things up more and more that we make the life increasingly harder for fullstack users. and i am not convinced yet that there really is much sense in sharing Bundles with non fullstack users.

from doctrinebundle.

schmittjoh avatar schmittjoh commented on July 18, 2024

I think it's just a matter of designing the extension in such a way that you can load only the things that you need.

from doctrinebundle.

stof avatar stof commented on July 18, 2024

Well, if you don't use annotations for your mapping, it should work without the annotation_reader service. If you use the annotations for the mapping, the service is obviously needed, and I don't think it is worth adding a compiler pass checking if the service is there and defining it otherwise.

And regarding moving the annotation_reader service outside FrameworkBundle, I don't think it is worth it either. It would make this bundle a mandatory dependency of FrameworkBundle

from doctrinebundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.