views:

28

answers:

1

I have place model & entry model that entry is parent
everything is fine but how can I delete the result row $categoryPlacements


in place model:
$entryModel = new Model_EntryModel();
$entryRow = $entryModel->find ( $entryId )->current ();
$categoryPlacements = $entryRow->findDependentRowset($this);


in this case i want to delete the $categoryPlacements result in place model
I can use categoryPlacements->toarray() and then delete but is another easy way?

A: 

Foering Keys at the database could solve this issue.

$categoryPlacements = $entryRow->findDependentRowset($this);
foreach ($categoryPlacements as $placement){
    $where = $db->getAdapter()->quoteInto('id = ?',$placement->id);
    $db->delete($where);
}

Sorry if this is not what you need, regard´s.

Rodrigo Ferrari