There are a number of problems that can cause this Doctrine error:
PHP Fatal error: Call to a member function evictAll() on a non-objectOne of them relates to using double quotes in a DQL statement. For example, the following will cause the aforementioned error:
$file = Doctrine_Query::create() ->from('TableOfFiles f') ->where('f.file_name = "myfile.fil"') ->fetchOne();In that case Doctrine interprets myfile to be some kind of class identifier. In addition to the PHP Fatal error, you might also see an error like this:
Couldn't find class "myfile#0 /var/webLib/symfony-1.4.11/lib/ plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Table.phpThe fix for this issue is simple. Just rewrite your statement to look like this:
$file = Doctrine_Query::create() ->from('TableOfFiles f') ->where('f.file_name = \'myfile.fil\'') ->fetchOne();Or even better (Thanks Steve Mobs) create a prepared statement and let Doctrine do the quotes for you:
$file = Doctrine_Query::create() ->from('TableOfFiles f') ->where('f.file_name = ?', array('myfile.fil')) ->fetchOne();It’s Documented
For those who are interested, there is actually a warning about using double quotes in DQL on the doctrine-project.org DQL Page.

what about this:
->where(‘f.file_name = ?’, array(‘myfile.fil’))
leave it up to doctrine to do the quotations…
Thanks, Steve. If that works, it’s definitely better than what I suggested.
You can use ” ->where(‘f.file_name = ?’, ‘myfile.fil’)” too.