nielsv nielsv - 7 months ago 117
PHP Question

TRUNCATE Table + Zend Framework

I do this:

$data = array('coords' => $district->getCoords(),
'id' => $district->getId(),
'fid' => $district->getFid(),
'wijziging'=> $district->getWijziging(),
'nieuwnr' => $district->getNieuwnr(),
'naam' => $district->getNaam(),
'wijk' => $district->getWijk(),
'wijknr' => $district->getWijknr(),
'objectid' => $district->getObjectid(),
'area' => $district->getArea(),
'len' => $district->getLen(),


_dbTable -> references to my table 'Districts'.

Now I want to clear the table first before I insert the data.

How can I do this?


Try to get the adapter if you really need to truncate the table

$this->_dbTable->getAdapter()->query('TRUNCATE TABLE '.$this->_dbTable->info(Zend_Db_Table::NAME));