class Model_Project extends Model_Table {
public $table = 'project';
function init(){
parent::init();
$this->addField('Title');
$this->addField('School');
$this->hasMany('mProjectContacts');
$this->hasMany('mProjectFunds');
$this->hasMany('Notes');
}
Class Model_Contact extends Model_Table {
public $table = 'contact';
function init() {
parent::init();
$this->addField('name');
$this->addField('title');
$this->addField('email');
$this->addField('phone');
$this->hasMany('mProjectContacts');
}
}
Class Model_Fund extends Model_Table {
public $table = 'fund';
function init() {
parent::init();
$this->addField('funder');
$this->addField('fund_type');
$this->addField('duration');
$this->hasMany('mProjectFund');
}
}
//Linked by the following:
class Model_mProjectContacts extends Model_Table {
public $table = 'm_project_contacts';
function init(){
parent::init();
$j = $this->join('contact');
$j->hasOne('Project');
}
}
class Model_mProjectFunds extends Model_Table {
public $table='m_project_funds';
function init(){
parent::init();
$j = $this->join('Project');
$j->hasOne('Fund');
}
}
Application Error: Database Query Failed
Exception_DB, code: 0
Additional information:
- pdo_error: SQLSTATE[42S22]: Column not found: 1247 Reference 'project_id' not supported (forward reference in item list)
- mode: select
- params:
- :a: Record #
- :a_2: 1
- query:
select `m_project_contacts`.`contact_id`,(select concat(:a,
`project`.`id`) from `project` where `_c`.`project_id` = `project`.`id`
) `project`,`m_project_contacts`.`id`,`_c`.`project_id`,`_c`.`id`
`_c` from `m_project_contacts` inner join `contact` as `_c` on `_c`.`id`
= `m_project_contacts`.`id` where `_c`.`project_id` = :a_2