Pimcore\Model\Object\ClassDefinition::delete PHP Method

delete() public method

public delete ( ) : void
return void
    public function delete()
    {
        // delete all objects using this class
        $list = new Listing();
        $list->setCondition("o_classId = ?", $this->getId());
        $list->load();
        foreach ($list->getObjects() as $o) {
            $o->delete();
        }
        $this->deletePhpClasses();
        // empty object cache
        try {
            Cache::clearTag("class_" . $this->getId());
        } catch (\Exception $e) {
        }
        // empty output cache
        try {
            Cache::clearTag("output");
        } catch (\Exception $e) {
        }
        $customLayouts = new ClassDefinition\CustomLayout\Listing();
        $customLayouts->setCondition("classId = " . $this->getId());
        $customLayouts = $customLayouts->load();
        foreach ($customLayouts as $customLayout) {
            $customLayout->delete();
        }
        $this->getDao()->delete();
    }