Pimcore\Model\Document\PageSnippet::delete PHP Метод

delete() публичный Метод

См. также: Document::delete
public delete ( ) : void
Результат void
    public function delete()
    {
        $versions = $this->getVersions();
        foreach ($versions as $version) {
            $version->delete();
        }
        // remove all tasks
        $this->getDao()->deleteAllTasks();
        parent::delete();
    }

Usage Example

Пример #1
0
 /**
  * @throws \Exception
  */
 public function delete()
 {
     if ($this->getId() == 1) {
         throw new \Exception("root-node cannot be deleted");
     }
     // check for redirects pointing to this document, and delete them too
     $redirects = new Redirect\Listing();
     $redirects->setCondition("target = ?", $this->getId());
     $redirects->load();
     foreach ($redirects->getRedirects() as $redirect) {
         $redirect->delete();
     }
     parent::delete();
 }