Pimcore\Model\Document\Hardlink::delete PHP Method

delete() public method

See also: Document::delete
public delete ( ) : void
return void
    public function delete()
    {
        // hardlinks cannot have direct children in "real" world, so we have to empty them before we delete it
        $this->childs = [];
        // 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();
        // we re-enable the children functionality by setting them to NULL, if requested they'll be loaded again
        // -> see $this->getChilds() , doesn't make sense when deleting an item but who knows, ... ;-)
        $this->childs = null;
    }