/** * Deletes a stock item from the backend. $object can be either a * primary key, an Rdo_Query object, or a Sesha_Entity_Stock object. * This also cleans up attached attributes and categories * * @param string|Sesha_Entity_Stock|Horde_Rdo_Query $object The Rdo object, * Horde_Rdo_Query, or unique id to delete. * * @return integer Number of objects deleted. */ public function delete($object) { if (!$object instanceof Sesha_Entity_Stock) { $object = $this->findOne($object); } foreach ($object->values as $value) { $value->delete(); } $object->removeRelation('categories'); return parent::delete($object); }