0
我有一個非常混亂的問題有關係涉及..的DataMapper在代碼點火器與許多許多
我配置數據映射,並開始使用代碼點火器使用它..我有這個類:
class FamilyMemberDetail extends DataMapper {
var $table = "family_members_details";
var $has_one = array('gender', 'maritalstate');
public function __toString() {
return is_string($this->id) ? $this->id : "";
}
}
對於性別它工作正常..
class Gender extends DataMapper {
var $table = "genders";
var $has_many = array("familymemberdetail");
public function __toString() {
return is_string($this->gender_label) ? $this->gender_label : "";
}
}
但隨着婚姻狀況:
class MaritalState extends DataMapper {
var $table = "marital_state";
var $has_many = array("familymemberdetail");
public function __toString() {
return is_string($this->marital_state_label) ? $this->marital_state_label : "";
}
}
我得到這個錯誤!
Error Number: 1146
Table 'elkhoudary_family.kh_family_members_details_marital_state' doesn't exist
SELECT `kh_marital_state`.* FROM (`kh_marital_state`) LEFT OUTER JOIN `kh_family_members_details_marital_state` kh_family_members_details_marital_state ON `kh_marital_state`.`id` = `kh_family_members_details_marital_state`.`maritalstate_id` WHERE `kh_family_members_details_marital_state`.`familymemberdetail_id` = 1
Filename: C:\AppServ\www\elkhoudary\system\database\DB_driver.php
Line Number: 330
的問題是,我並沒有說明這種關係需要一個連接表,但.. CI堅持認爲,它需要之間的表..是不是應該像性別工作..什麼我在這裏想念嗎?