Exemple #1
0
 /**
  * Function to delete an atom from Concept collection
  * @param array $options
  * @throws Exception when delete is not allowed/possible
  * @return void
  */
 public function delete($options = array())
 {
     $this->logger->debug("delete() called on {$this->path}");
     // CRUD check
     if (!$this->parentIfc->crudD) {
         throw new Exception("Delete not allowed for '{$this->path}'", 405);
     }
     if (!$this->parentIfc->tgtConcept->isObject) {
         throw new Exception("Cannot delete non-object '{$this->__toString()}' in '{$this->path}'. Use PATCH remove operation instead", 405);
     }
     if ($this->parentIfc->isRef()) {
         throw new Exception("Cannot delete on reference interface in '{$this->path}'. See #498", 501);
     }
     // Handle options
     if (isset($options['requestType'])) {
         $this->database->setRequestType($options['requestType']);
     }
     // Perform delete
     $this->deleteAtom();
     // Close transaction
     $this->database->closeTransaction($this->concept . ' deleted');
     return;
 }