In my Symfony 1.4 project in one of my class.php file I used the following codes to execute query and fetch object.
$statement = Doctrine_Manager::connection()->execute($query);
$resultset = $statement->fetchAll(PDO::FETCH_OBJ);
I tried to use try-catch block to catch any run-time exceptions. I can easily do that for the first line like
try {
$statement = Doctrine_Manager::connection()->execute($query);
}
catch (Exception $exc) {
echo "custom error message";
}
But, I this dosen't work for the second line. It always show the following error when I run the page
Fatal error: Call to a member function fetchAll() on a non-object in
\lib\model\doctrine\DeductionInfo.class.php on line 104
How can I resolve this?