News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Srdjan Vranac's Blog:
Custom Repository with DIC in Symfony2
August 25, 2011 @ 09:02:00

Srdjan Vranac has a new post to his blog showing you how to create a custom repository with the dependency injection features that already come with the Symfony2 framework.

I am currently working on some Symfony2 bundles, I needed a custom repository to house hold my custom queries, that part is easy with sf2, and quite nicely explained in the Manual.

He walks you through the setup of a simple custom repository (a part of a Code4Hire bundle) and a (less elegant) call that can be used to reference it and its methods. To make things a big more clean and take advantage of the full dependency injection features of the framework, he makes a change to move the repository into the services.xml. This defines the container and makes it available to the application directly in function calls (like his render() example near the end of the post).

0 comments voice your opinion now!
custom repository symfony2 dependency injection tutorial


blog comments powered by Disqus

Similar Posts

Mike Purcell's Blog: Symfony - sfGuardPlugin - Use Email Instead of Username

Zend Developer Zone: Integrating Propel with the Zend Framework

Project: Symfony2 Deployment Checklist

PHPMaster.com: Build a CRUD App with Yii in Minutes

Ralph Schindler's Blog: Compiling Gearman (or anything) for Zend Server CE on Snow Leopard


Community Events





Don't see your event here?
Let us know!


release library voicesoftheelephpant introduction deployment package api bugfix laravel unittest opinion language interview zendserver framework podcast symfony community series install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework