2010-08-30 70 views
0

對於一個項目,我需要更新PK包含兩列的行。Zend Framework複合主鍵更新

起初我以爲我應該這樣做,但它給了我錯誤。任何人都有解決方案?

$data = array('foo','bar'); 
$where = $this->_getGateway()->getAdapter() 
        ->quoteInto(array('customerId=?','date=?'), array($comment->customerId, $comment->date)); 
$this->_getGateway()->update($data, $where); 

感謝

回答

2

明白了!

$whereId = $this->_getGateway()->getAdapter()->quoteInto('customerId=?', $comment->customerId); 
$whereDate = $this->_getGateway()->getAdapter()->quoteInto('date=?', $comment->date); 
$this->_getGateway()->update($data, array($whereId, $whereDate));