Zend_Db_Table_Abstract remove

I'm trying to delete a line, can someone tell me the correct syntax for this?

class Application_Model_Event extends Zend_Db_Table_Abstract {

    protected $_name = 'xx';
    protected $_primary = 'xx';

   public function deleteEvent ( $xx) {

        $this->delete( $this->select()->where('idEvent = ?', '8'));

    }
}
+3
source share
2 answers

No, the delete () function simply accepts the WHERE clause.

$this->delete("idEvent=8");

Unfortunately, the method does not understand a form with two arguments, for example, "Select objects". Therefore, if you want to interpolate variables into it, you must do this in two stages:

$where = $this->getAdapter()->quoteInto("idEvent = ?", 8);
$this->delete($where);
+8
source

To delete a row with idEvent 8:

$this->delete(Array("idEvent = ?" => 8));

It will perform all the correct quotes and sanitize values ​​without the need for an additional quoteInto operator.

+11
source

Source: https://habr.com/ru/post/1751940/


All Articles