0
我試圖更新processForm()中的外鍵並獲取此錯誤。 這是一個有效的值 我可以設置值,正常的場沒有問題,當我嘗試更新外鍵無法調用Doctrine_Core :: set(),第二個參數應該是Doctrine_Record或Doctrine_Null設置一對一參考時的實例
這樣,我的錯誤,我只得到這個錯誤:
$form->getObject()->setPriority(1);
這樣我沒有錯誤,但不會太工作:
$form->getObject()->setPriorityId(1);
模式:
schedule:
columns:
id:
primary: true
type: integer
notnull: true
autoincrement: true
sdate:
type: date
notnull: true
stime:
type: time
notnull: true
scope:
default: 1
type: boolean
schedule_count:
default: 0
type: integer(4)
reschedule_justify:
type: string
priority_id:
type: integer
notnull: true
schedule_type_id:
type: integer
notnull: true
pending_id:
default: NULL
type: integer
cancelled_id:
default: NULL
type: integer
scheduled_by:
type: integer
notnull: true
in_charge:
type: integer
notnull: true
so_id:
unique: true
type: integer
notnull: true
relations:
priority:
local: priority_id
foreign: id
scheduleType:
local: schedule_type_id
foreign: id
cancelled:
onDelete: SET NULL
local: cancelled_id
foreign: id
pending:
onDelete: SET NULL
local: pending_id
foreign: id
ScheduledBy:
class: employee
local: scheduled_by
foreign: id
InCharge:
class: employee
local: in_charge
foreign: id
soOrder:
local: so_id
foreign: id
Employees:
class: employee
refClass: schedule_employee
local: schedule_id
foreign: employee_id
priority:
actAs:
SoftDelete:
columns:
id:
primary: true
type: integer
notnull: true
autoincrement: true
name:
unique: true
type: string(255)
notnull: true
img:
type: string(255)
這些是我正在使用的主表,我正在按計劃嘗試更新優先級
首先你不應該在processForm()中做它,因爲當form被保存時,對象的值將被表單的值覆蓋(在sfForm :: doSave方法中)。你應該在yourModelForm :: doSave或yourModel :: save中做到這一點 – Dziamid 2011-04-07 20:41:20
你能舉一些例子嗎? – Marcelo 2011-04-08 11:04:35
發佈您的架構 – Dziamid 2011-04-08 11:37:23