我在会话中保存表单数据,并尝试使用会话数组保存到名为Property的模型。请参阅下面的数组。我认为这与Session数组有关,但我不确定。
当我尝试这样保存时,它不会保存:
$this->Property->save($propertyData) where $propertyData is the property array.
sql_dump:
INSERT INTO `fra`.`properties` (`type`, `address`, `city`, `state`, `zip`, `price`, `bed_rooms`, `bath_rooms`, `lot_size_sq_ft`)
VALUES ('0', '2720 Acapulco way', 'modesto', 'ca', '95355', 310000, 4, 3, 6040)
会话数组是:
Array
(
[house_details] => Array
(
[form] => Array
(
[section] => house_details
)
[Property] => Array
(
[type] => 0
[address] => 2720 Acapulco way
[city] => modesto
[state] => ca
[zip] => 95355
[price] => 310000
[prop_year_build] => 2007
[prop_year_remodel] =>
[bed_rooms] => 4
[bath_rooms] => 3
[garage_spaces] => 3
[lot_size_sq_ft] => 6040
[house_size_sq_ft] => 3720
[stories] => 2
[condition_rating] => 8
)
答案 0 :(得分:1)
你应该能够很简单地做到这一点。您可能会将$propertyData
设置为错误的问题,因此它不会为模型保存提供有效值。
如果你做debug($propertyData)
,你会得到什么?
这有用吗?
$propertyData = $this->Session->read('house_details.Property');
$this->Property->save(propertyData);