Zend Framework compound primary key update
For a project I need to update a row where the PK contains two columns.
At first I thought I should do it like this but it gives me errors. Anybody with a solution?
$data = array('foo','bar');
$where = $this->_getGateway()->getAdapter()
->quoteI开发者_JAVA技巧nto(array('customerId=?','date=?'), array($comment->customerId, $comment->date));
$this->_getGateway()->update($data, $where);
Thanks
Got it!
$whereId = $this->_getGateway()->getAdapter()->quoteInto('customerId=?', $comment->customerId);
$whereDate = $this->_getGateway()->getAdapter()->quoteInto('date=?', $comment->date);
$this->_getGateway()->update($data, array($whereId, $whereDate));
精彩评论