delete() public method

Deletes a single object.
public delete ( object $entity ) : boolean
$entity object The entity to delete.
return boolean
Example #1
0
 /**
  * Execute the deletion of a record.
  *
  * @param Repository $repo
  * @param Content    $entity
  *
  * @return boolean
  */
 protected function deleteRecord(Repository $repo, Content $entity)
 {
     $recordId = $entity->getId();
     $contentTypeName = (string) $entity->getContenttype();
     if (!$this->users->isAllowed("contenttype:{$contentTypeName}:delete:{$recordId}")) {
         $this->loggerFlash->error(Trans::__('general.access-denied.content-not-modified', ['%title%' => $entity->getTitle()]));
         return;
     }
     return $repo->delete($entity);
 }