/**
  * Deletes a bean from the database
  * @param RedBean_OODBBean $bean
  */
 public function trash(RedBean_OODBBean $bean)
 {
     $this->signal("delete", $bean);
     $this->check($bean);
     try {
         $this->writer->deleteRecord($bean->getMeta("type"), "id", $bean->id);
     } catch (RedBean_Exception_SQL $e) {
         if ($e->getSQLState() != "42S02" && $e->getSQLState() != "42S22") {
             throw $e;
         }
     }
 }