Injecting repositories to service in Symfony2

It is generally a good idea to wrap business logic into services. Often, such services methods uses doctrine’s repositories to operate on data storage. Injecting whole EntityManager service is very popular approach, but it isn’t the most elegant way I could think of. EntityManager works only as a factory in that case and could lead to usage of other repositories, which might end up with too many responsibilities of given service.
The better way, is to inject single repositories, using factory-service mechanizm, provided by Dependency Injection Container.

Read more

Symfony2 stable is available, what’s the big deal?

On July 28th Symfony2 was finally released, with launch parties all over the world. Developers are excited, managers are excited and whole ecosystem is happy. They’re right, there are plenty of reasons to be optimistic. symfony 1.x is a great framework, I made many  projects with it, nevertheless Symfony2 is a new way of doing things in PHP. I observe, that applications made with symfony 1 tends to be messy with raising number of functionalities. There too many magic tricks, which you can use, which are hard to manage in big, multi-team projects. Symfony2 does it smarter.

Read more
Back to top