[eluser]developer10[/eluser]
Well, for the past 5-6 days I have been struggling to rewrite somewhat small amount of code of my current project to work with Doctrine.
Since Doctrine's documentation says little about integration with CI, I have several questions:
1. If I have a function/query in Doctrine model, can it be called from my controller like this:
Code:
$var = Doctrine::getTable('classFromMyModel');
2. If YES, would it be correct to say that the above is a real equivalent of:
Code:
$var = $this->modelName->functionName();
I need to get that class/model into $var variable and then call a function from that class, like this:
Code:
$categories = $var->get_categories();
When I want to do $var = Doctrine::getTable('classFromMyModel'); I end up with this Doctrine error:
Code:
Fatal error: Uncaught exception 'Doctrine_Table_Exception' with message 'Unknown method Doctrine_Table::get_categories' in C:\xampp\htdocs\uposlidoct\application\plugins\doctrine\lib\Doctrine\Table.php:2856
Stack trace:
#0 [internal function]: Doctrine_Table->__call('get_categories', Array)
#1 C:\xampp\htdocs\uposlidoct\application\controllers\kategorije.php(18): Doctrine_Table->get_categories()
#2 [internal function]: Kategorije->index()
#3 C:\xampp\htdocs\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array)
#4 C:\xampp\htdocs\uposlidoct\index.php(115): require_once('C:\xampp\htdocs...')
#5 {main} thrown in C:\xampp\htdocs\uposlidoct\application\plugins\doctrine\lib\Doctrine\Table.php on line 2856