He returned to the same boat. Ended up without using Doctrine ORM, but in principle you are right - you need a “service level” for everything that is not directly modeled using Doctrine objects and repositories.
How do I do this by creating a folder with names in / application / for my project code. Then I used the Doctrine Common class loader to recognize this folder as a namespace. For example, /application/Acme/Authentication.php contains:
namespace Acme; class Authentication {
The Doctrine class loader class uses SPL (spl_autoload_register or something else). This means that you can make full use of the PHP 5.3 namespaces. Then you have all the fun tests and intimidation injection dependencies to access the dbal doctrine within this level of service. Then your controllers will use this "service level". As I said, in my case I decided not to use Doctrine ORM, so I use the CodeIgniters ActiveRecord database classes inside my “service level”. Instead of using $ this-> CI = & get_instance () ... I provide access to the database in the constructors using the DI container.
For example, in my authorization / login controller action, I can have
function login() { $user = $_POST['u']; $pass = $_POST['p']; $auth = new Acme\Authentication($this->db);
source share