Hi,
Sorry to bother you again.
I have a problem with a model class named LessonRequests, it gives me PHP Fatal error. The table name of the corresponding MySQL table is lesson_requests, when I execute new LessonRequests() in my controller it gives the PHP Fatal error; if I add a line require APP_PATH . "app/models/LessonRequests.php";, it works; all other model classes works without the require line except LessonRequests. More information: I have 16 model files in the APP_PATH . "app/models/" directory.
Do any of you have similar problem or know what the problem might be?
Thanks in advance
update: if I change the file name and class name to LessonRequest or LessonRequestss, it loads; if I change the file name and class name to LessonRequests_ or LessonRequests_r it fails to load. However I still haven't find the solution to make LessonRequests load.
codes:
<?php
/*
file and directory structure:
app/
    ...
    controllers/
        ...
        LessonsController.php
        LessonRequestsController.php
        TestController.php
        ...
    models/
        ...
        LessonRequests.php
        ...
    ...
public/
    ...
...
*/
/*
 * (start) loader (PHP file)
 */
$loader = new Phalcon\Loader();
$loader->registerDirs(
    array(
        APP_PATH . $config->application->controllersDir,
        APP_PATH . $config->application->libraryDir,
        APP_PATH . $config->application->modelsDir, // modelsDir = app/models/
        APP_PATH . $config->application->pluginsDir,
        APP_PATH . $config->application->customhelpersDir,
        APP_PATH . $config->application->validatorsDir
    )
)->register();
/*
 * (end) loader (PHP file)
 */
/*
 * (start) class LessonRequests (PHP file)
 */
 // even I make this file as simple as one line "class LessonRequests{}", it still doesn't work.
use Phalcon\Db\RawValue;
use Phalcon\Mvc\Model\Query;
class LessonRequests extends ModelBase{
    // .......
    // I tried to remove different parts of the codes of this class, couldn't get it to work.
}
/*
 * (end) class LessonRequests (PHP file)
 */
 /*
 * (start) class LessonsController (PHP file)
 */
class LessonsController extends ControllerBase{
    public function initialize(){
        parent::initialize();
        parent::tag_title_set('lessons');
        parent::MyTags_page_heading_set('lessons');
    }
}
/*
 * (end) class LessonsController (PHP file)
 */
/*
 * (start) class LessonRequestsController (PHP file)
 */
class LessonRequestsController extends ControllerBase{
    public function initialize(){
        parent::initialize();
        parent::tag_title_set('lesson request');
        parent::MyTags_page_heading_set('lesson request');
    }
    public function registerAction(){
        $this->dispatcher->forward(array(
            'controller' => 'lessonRequests',
            'action'     => 'registerPrepare'
        ));
        return;
    }
    public function registerPrepareAction(){
        $this->MyTags->page_heading_append('register');
        $systemUser_loggedIn = $this->systemUserLibrary->systemUser_loggedIn_get();
        $tutor_id            = $this->dispatcher->getParam('tutors_id') ? intval($this->dispatcher->getParam('tutors_id')) : NULL;
        if($tutor_id){
            $this->view->setVar('tutors_id', $tutor_id);
            $this->view->pick('lessonRequests/form');
        }else{
            parent::redirect('errors/userCauseError');
            return;
        }
    }
}
/*
 * (end) class LessonRequestsController (PHP file)
 */
/*
 * (start) (action of a controller)
 */
public function testAction(){
    require APP_PATH . 'app/models/LessonRequests.php'; // with this line, both lines below work; without this line, only the "$s = new TutorsSubjects();" line works.
    $s = new TutorsSubjects(); // corresponding to MySQL table tutors_subjects
    $l = new LessonRequests(); // corresponding to MySQL table lessons_requests
}
/*
 * (end) (action of a controller)
 */