對不起,對於這個非常具體的問題,我幾次遇到這個問題,我的解決方案(不是最好的是重命名錶和做更多的東西),顯然它不是一個真正的解決方案,這次我再次陷入同樣的情況,與我甚至沒有操縱過的桌子,我想知道是否有人以前遇到同樣的問題。如何解決symfony 1.4使用原則的「列未找到」衝突?
在symfony 1.4和理論工作,我從一個不相關的表的查詢得到這個錯誤
Column not found: 1054 Unknown column 'o.training_id' in 'field list'
我真的不知道什麼是錯,在我的schema.yml我有這樣的事情
OhrmTraining:
connection: doctrine
tableName: training
columns:
id_training:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
name:
type: string(60)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
TrainingDetail:
connection: doctrine
tableName: training_detail
columns:
id_training_detail:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
training:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
relations:
OhrmTraining:
local: training
foreign: id_training
type: one
與其他表詳細相關
這樣
TrainingDetail:
connection: doctrine
tableName: training_detail
columns:
id_training_deetail:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
training:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
relations:
Training:
local: training
foreign: id_training
type: one
,我認爲它是正確的,但是在我的學說/基/ BaseTraining.class我在結束這樣的事情(培訓)
public function setUp()
{
parent::setUp();
$this->hasMany('TrainingDetail', array(
'local' => 'id', <--- this should be the id_training_detail??
'foreign' => 'training_id')); <--- this should be training?
我不知道他們爲什麼是這樣的,或者如果他們應該是這樣的...有人能幫助我嗎?
我改變了他們對
public function setUp()
{
parent::setUp();
$this->hasMany('TrainingDetail', array(
'local' => 'id_training',
'foreign' => 'training'));
不過,我得到的錯誤,如果我做一個重拍車型都將蕩然無存
有沒有簡單的方法來創建在schema.yml文件一個數據庫?
編輯: 拋出異常的查詢是這樣的
$query = Doctrine_Query::create()
->from('Times a')
->where('a.employee_id = ?', $employeeId)
->orderBy('a.start_date ASC');
$results = $query->execute();
我的員工的基礎上檢查,並與訓練沒有關係,它與訓練的細節......但不直接與訓練中,我重新創建我的模型10次,還是一樣
我不認爲我可以開始做你的方案的意義,因爲你的條款很混亂。也就是說,你在幾個地方拼寫'訓練'作爲'訓練'。也就是說,在你的關係中,你正在定義'local:training',除了該字段被命名爲'trainning'。也可能有其他錯誤。 – Slickrick12
對不起,真實姓名沒有訓練,其公司有什麼訓練,但我對此案例進行了更改 – jpganz18
仔細檢查整個模式文件的拼寫和縮進。如果縮進是錯誤的學說可能會混淆。 –