We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon model manager

I am trying to create a query like

SELECT *
FROM course
where course.id IN(
 SELECT DISTINCT(course_id)
FROM course_timing tim
WHERE tim.date >= CURDATE()
)

I have set the model manger

$di->set('modelsManager', function() {
    return new Phalcon\Mvc\Model\Manager();
});

But when I try to use

$phql = "SELECT * FROM CourseTiming";
$rows = $this->modelsManager->executeQuery($phql);

I am getting

Model 'CourseTiming' could not be loaded

Or is there any way to run the above query using Model::find etc



98.9k

This means it can't load a model called CourseTiming. Do you have a model with that name?



4.2k
Accepted
answer
edited Jul '14

I actually found the answer. The problem was that I am using namespace so I have to give it the full path.