Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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



83.0k

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



2.4k
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.