Best Practice for Developing Core Functions in Symfony2?
I am an experienced Symfony user and have started using Symfony2 and absolutely love it. A big thank you to Fabien and the guys over at Sensio.
I am pretty much there now in terms of developing in Symfony2 thanks to the documentation available, but there is one area in particular that I am still not 100% sure on.
I have a number of core functions that I want to use in different areas of the application and just want to know what the best practice for this is?
I am currently creating a bundle that has a number of functions in that handles the processing of images.
Is this the best way to do this and if so how do I then use or include these f开发者_Python百科unctions across other bundles?
You could just import the classes you want to use from your image handler bundle, but the way I would go about it is to register one or more services (like an image manager or thumbnail generator or whatnot) from your bundle so that the functionality you are creating will be available through the DIC for the entire application to use.
精彩评论