Quick search:

How to delete persistent objects from the database

From php code, a persistent object can be deleted from the database by calling its delete method. Depending on the implementation of this method, other objects may be deleted too. Since version 1.4.beta1 cascaded delete is supported: PntDbObject::delete will recursively delete multi property values for properties with onDelete set to 'd'.

Sometimes you may want to prevent deletion, for example because dependent objects exist. You can override getDeleteErrorMessages to prevent deletion by PntObjectDelete(Maked)Action. Since version 1.4.beta1 you can also prevent an object to be deleted if one of its multi value property holds values by calling setOnDelete (example).

From the web based user interface, a persistent object can be deleted by sending a request to index.php with pntHandler=DeleteAction, pntType= the type of peanut to delete and id= the id of the peanut to delete. This request will get dispatched to a DeleteAction (ObjectDeleteAction or a specialized one) that will check getDeleteErrorMessages and eventually delete the object. If it fails it will forward the request with an error message to an EditDetailsPage with the same pntType and id. If it succeeds it will try to use the pntContext for a redirect, if there is no pntContext it will redirect to an IndexPage with the same pntType.

From the web based user interface multiple persistent objects can be deleted by sending a form with oids to index.php with pntHandler=DeleteMarkedAction and pntTpe= the type of the objects to be deleted. See the forms in IndexPages for examples. Forwarding- and redirection behavior of ObejctDeleteMarkedAction is the same as ObjectDeleteAction.

Since version 1.2, the default user interface shows a confirmation dialog before deleting. The question shown in this dialog can be overridden, see how to translate a delete confirmation question.