I am using Kohana v3 with database and ORM. I found a good question that helps me add and read extra columns in pivot tables:
Kohana 3.0.x ORM: read extra columns in pivot tables
I have 2 pivot table with an extra column. One of these works is excellent, but I'm stuck in suspense with the second.
Get 2 tables, applications and partners plus my pivot table with the following ORM models:
class Model_Application extends ORM
{
protected $_has_many = array(
'partners'=>array(
'model'=>'partner',
'through'=>'partners_applications',
)
);
}
class Model_Partner extends ORM
{
protected $_has_many = array(
'applications' => array(
'model'=>'application',
'through'=>'partners_applications',
)
);
}
class Model_Partners_applications extends ORM
{
protected $_belongs_to = array(
'partner' => array(),
'application' => array()
);
}
When i try to get
$instance = ORM::factory('partners_applications',array('partner_id' => $this->partner,'application_id' => $this->application))->find();
Kohana continues to say:
ErrorException [ Fatal Error ]: Class 'Model_Partners_applications' not found
I have tested model name constructions three times, but I cannot find the error. In the debugging part of the Kohana environment, my first two models are loaded, but not a pivot table.
Any ideas?
Pioup source
share