eZ\Publish\Core\Repository\SectionService::deleteSection PHP Метод

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

Deletes $section from content repository.
public deleteSection ( eZ\Publish\API\Repository\Values\Content\Section $section )
$section eZ\Publish\API\Repository\Values\Content\Section
    public function deleteSection(Section $section)
    {
        $loadedSection = $this->loadSection($section->id);
        if ($this->repository->canUser('section', 'edit', $loadedSection) !== true) {
            throw new UnauthorizedException('section', 'edit', array('sectionId' => $loadedSection->id));
        }
        if ($this->sectionHandler->assignmentsCount($loadedSection->id) > 0) {
            throw new BadStateException('section', 'section is still assigned to content');
        }
        if ($this->sectionHandler->policiesCount($loadedSection->id) > 0) {
            throw new BadStateException('section', 'section is still being used in policy limitations');
        }
        $this->repository->beginTransaction();
        try {
            $this->sectionHandler->delete($loadedSection->id);
            $this->repository->commit();
        } catch (Exception $e) {
            $this->repository->rollback();
            throw $e;
        }
    }