I was studying how to work with entities following http://www.bluespark.com/blog/drupal-entities-part-3-programming-hello-drupal-entity.
I downloaded the module, created by the author of that article. Then I wanted to delete entities, using the following code.
entity_delete_multiple('basic', array(1,4) );
But it didn't delete anything. I though that the delete
method should be implemented, and added it into the class.
class BasicController extends DrupalDefaultEntityController{
public function delete($basic) {
var_dump(1);exit;
db_delete('basic')
->condition('basic_id', $basic->basic_id, '=')
->execute();
field_attach_update('basic', $basic);
module_invoke_all('entity_delete', 'basic', $basic);
}
};
It doesn't work: 1
is not printed.
How do I delete an entity with fields?