phpzend-frameworkzend-studiozend-db-table

Zend - db table not found in another module


I have an application with three modules:default, disciplines and plans. In disciplines I have a dbtable which works fine in this module, but if I want to use the dbtable in module plans inside plans_dbtable I get

Class 'Disciplines_Model_DbTable_Disciplines' not found in C:\xampp\htdocs\proiect_mps\application\modules\plans\models\DbTable\Plans.php on line 43.

Require_once and include don't solve the problem. I have Disciplines_Boostrap and Plans_Bootstrap classes written. But it doesn't work. Any ideas?

class Plans_Model_DbTable_Plans extends Zend_Db_Table_Abstract
{
    ...
    public function addPlan(
        $year,
        $name,
        $code,
        $domain,
        $specialization,
        $years)
    {
     
       // Id-ul disciplinei
       $id_discipline = 0;
       $discipline = new Disciplines_Model_DbTable_Disciplines();
       ....
    }
    ...
}
    

Solution

  • I think I've resolved it myself. I had to write

    require_once(APPLICATION_PATH.'/modules/disciplines/models/DbTable/Disciplines.php');
    

    instead of

    require_once '/proiect_mps/application/modules/disciplines/models/DbTable/Disciplines.php';
    

    This also works:

    require_once('/../../../disciplines/models/DbTable/Disciplines.php');
    

    for my folder structure.