Do you have error 404 page set up in your web app? I believe that it is showing you that error page. Because I had same problem with my app. You are trying to use this query for PDO option and other stuff. As far I know, this is not PHQL. And to access this modelManager, you will need few more lines of codes in DI services. I couldn't figure out this problem and I had same question that I asked here. So, try to read everything there and solution that Phalcon user, (one of the developers) gave me. But still, I suggest you to use your code like below if your these codes are in controller. (and you will need something to select row from table)
// Get and print global setttings to print details
$globalSettings = Settings::find(array(
"initial_balance < '300'"
));
foreach ($globalSettings as $settingsData) {
$settings[] = array(
'initial_balance' => $settingsData->initial_balance,
'site_mail' => $settingsData->site_mail
);
}
So it means, you are trying to find a row where initial balance is lower then 300 and it will fetch all data from that row. Its not perfect way because there might be more then one row in your database so you can do like
"initial_balance < '300'",
"username = 'myName'"
in your PHQL so you will get accutrate result. Try this. If it doesn't work, let me know. ;) Enjoy your codes.
And also add this codes in your services file at located config/services.php.
//trying to display error pages
$di->set('dispatcher', function() {
$eventsManager = new \Phalcon\Events\Manager();
$eventsManager->attach("dispatch:beforeException", function($event, $dispatcher, $exception) {
//Handle 404 exceptions
if ($exception instanceof \Phalcon\Mvc\Dispatcher\Exception) {
$dispatcher->forward(array(
'controller' => 'error',
'action' => 'show404'
));
return false;
}
//Handle other exceptions
$dispatcher->forward(array(
'controller' => 'error',
'action' => 'show503'
));
return false;
});
$dispatcher = new \Phalcon\Mvc\Dispatcher();
//Bind the EventsManager to the dispatcher
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
}, true);
It will help you to show error pages like 404 and 503 etc. Create error class and a method to show 404 error page. ;)