Category: Doctrine

Doctrine 2 Exception EntityManager is closed

Doctrine 2’s EntityManager class will permanently close connections upon failed transactions. Thus, further requests using these closed instances will fail with the following exception: So, make sure to check your EntityManager’s state before your actual tasks: Better, create a function called getEntityManager that takes care of this check and makes sure that you always get […]

Managing Doctrine 2 Entity Model mapping classes using YamlDriver in Zend Framework 2

This post continues my approach to integrate Doctrine 2 into Zend Framework 2 by additionally setting up YamlDriver to generate and manage Doctrine 2 Entity model mapping files. First, we need to install the YAML dependency symfony/yaml: And rebuild our project: In case you forget the install the symfony/yaml module you will get an error […]

Doctrine_Pager error “Invalid parameter number” when using “IN” in “WHERE” clause

This post is just to inform fellow users of Doctrine about a problem with Doctrine_Pager using “IN” for “WHERE” clauses. Simply put: Just don’t use it (at the moment), as it will result in the following error: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens Instead, use orWhere() for […]