Hi,
Am I doing something wrong here?
Code:
<?php
class Model_DbTable_CoreSections extends Zend_Db_Table_Abstract{
protected $_name = 'core_sections';
public function updateSection($id, $data){
$where = $this->getAdapter()->quoteInto('id = ?', $id);
$this->update($data, $where);
}
}
?>
I'm accesing the updateSection function in my controller where I pass it $data and $id.
Data looks lyke this
Code:
$data = array(
'gen_user_id' => $this->credidentials->id,
'gen_status_id' => $this->formObject->getValue('status'),
'core_section_type_id' => $this->formObject->getValue('sectionType'),
'label' => $this->formObject->getValue('label'),
'created' => new Zend_Db_Expr('NOW()'),
'modified' => new Zend_Db_Expr('NOW()')
);
The $data array dump looks like this
Code:
Array
(
[gen_user_id] => 1
[gen_status_id] => 1
[core_section_type_id] => 2
[label] => test plictiseala
[created] => Zend_Db_Expr Object
(
[_expression:protected] => NOW()
)
[modified] => Zend_Db_Expr Object
(
[_expression:protected] => NOW()
)
)
For some reason the update is not executed.
The Zend Profiler shows me this:
Code:
object(Zend_Db_Profiler_Query)#92 (5) {
["_query":protected]=>
string(162) "UPDATE `core_sections` SET `gen_user_id` = ?, `gen_status_id` = ?, `core_section_type_id` = ?, `label` = ?, `created` = NOW(), `modified` = NOW() WHERE (id = '6')"
["_queryType":protected]=>
int(8)
["_startedMicrotime":protected]=>
float(1268166988.9384)
["_endedMicrotime":protected]=>
float(1268166989.0624)
["_boundParams":protected]=>
array(4) {
[1]=>
string(1) "1"
[2]=>
string(1) "1"
[3]=>
string(1) "2"
[4]=>
string(16) "test plictiseala"
}
}
As you can see in the profiler log in the sql the only values that appear are for created, modified and id (in WHERE clause)!
For some reason update in my updateSection function doesn't take the $data
Any ideas anyone?
Thanks
P.S. In Model_DbTable_CoreSections I have other insert and select functions which work just fine.