« Return to Thread: Zend_DB_Table: delete() won't delete any row in dependent tables

RE: Zend_DB_Table: delete() won't delete any row in dependent tables

by Thomas D.-2 :: Rate this Message:

Reply to Author | View in Thread

Hi,

Andrew Ballard wrote:

> You are changing the syntax between the two examples. In the first,
> you are calling finding a specific row and
> Zend_Db_Table_Row_Abstract::delete() on that row, which is what is
> shown in the documentation. This function scans the dependent tables
> and deletes all dependent rows.
>
> In the second, you are calling the Zend_Db_Table_Abstract::delete()
> method, which simply calls delete() on the database adapter.
>
> It looks like you just need to change your doSth() method to this:
>
> class Drivers extends Zend_Db_Table_Abstract
> {
>    [...]
>    public function doSth($id)
>    {
>        $driversRowset = $this->find($id);
>        $driver = $driversRowset->current();
>
>        $driver->delete();
>
>        // do my other stuff
>        [...]
>    }
> }

You are right. The delete() method, which will delete rows in dependent tables is the delete() method of the Zend_Db_Table_Row, but I was using the delete() method of Zend_Db_Table.

Your solution is working fine.

Thank you Andrew.


--
Regards,
Thomas


 « Return to Thread: Zend_DB_Table: delete() won't delete any row in dependent tables