Copied!

SectionService

SectionService.php : 20

Section service, used for section operations.

Methods

publicassignSection()

SectionService.php : 110

Assigns the content to the given section this method overrides the current assigned section.

public assignSection(ContentInfo $contentInfo, Section $section) : void

Parameters

Name Type Default value Description
$contentInfo ContentInfo - -
$section Section - -
Tags
Throws
UnauthorizedException

If user does not have access to view provided object

publicassignSectionToSubtree()

SectionService.php : 118

Assigns the subtree to the given section this method overrides the current assigned section.

public assignSectionToSubtree(Location $location, Section $section) : void

Parameters

Name Type Default value Description
$location Location - -
$section Section - -

publiccountAssignedContents()

SectionService.php : 87

Counts the contents which $section is assigned to.

public countAssignedContents(Section $section) : int

Parameters

Name Type Default value Description
$section Section - -

Return values

int

Tags
Deprecated

since 6.0

publiccreateSection()

SectionService.php : 32

Creates the a new Section in the content repository.

public createSection(SectionCreateStruct $sectionCreateStruct) : Section

Parameters

Name Type Default value Description
$sectionCreateStruct SectionCreateStruct - -

Return values

Section

The newly create section

Tags
Throws
UnauthorizedException

If the current user user is not allowed to create a section

Throws
InvalidArgumentException

If the new identifier in $sectionCreateStruct already exists

publicdeleteSection()

SectionService.php : 130

Deletes $section from content repository.

public deleteSection(Section $section) : void

Parameters

Name Type Default value Description
$section Section - -
Tags
Throws
NotFoundException

If the specified section is not found

Throws
UnauthorizedException

If the current user user is not allowed to delete a section

Throws
BadStateException

if section can not be deleted because it is still assigned to some contents.

publicisSectionUsed()

SectionService.php : 100

Returns true if the given section is assigned to contents, or used in role policies, or in role assignments.

public isSectionUsed(Section $section) : bool

This does not check user permissions.

Parameters

Name Type Default value Description
$section Section - -

Return values

bool

publicloadSection()

SectionService.php : 57

Loads a Section from its id ($sectionId).

public loadSection(int $sectionId) : Section

Parameters

Name Type Default value Description
$sectionId int - -

Return values

Section

Tags
Throws
NotFoundException

if section could not be found

Throws
UnauthorizedException

If the current user user is not allowed to read a section

publicloadSectionByIdentifier()

SectionService.php : 76

Loads a Section from its identifier ($sectionIdentifier).

public loadSectionByIdentifier(string $sectionIdentifier) : Section

Parameters

Name Type Default value Description
$sectionIdentifier string - -

Return values

Section

Tags
Throws
NotFoundException

if section could not be found

Throws
UnauthorizedException

If the current user user is not allowed to read a section

publicloadSections()

SectionService.php : 64

Loads all sections, excluding the ones the current user is not allowed to read.

public loadSections() : array<string|int, Section>

Return values

array<string|int, Section>

publicnewSectionCreateStruct()

SectionService.php : 137

Instantiates a new SectionCreateStruct.

public newSectionCreateStruct() : SectionCreateStruct

Return values

SectionCreateStruct

publicnewSectionUpdateStruct()

SectionService.php : 144

Instantiates a new SectionUpdateStruct.

public newSectionUpdateStruct() : SectionUpdateStruct

Return values

SectionUpdateStruct

publicupdateSection()

SectionService.php : 45

Updates the given in the content repository.

public updateSection(Section $section, SectionUpdateStruct $sectionUpdateStruct) : Section

Parameters

Name Type Default value Description
$section Section - -
$sectionUpdateStruct SectionUpdateStruct - -

Return values

Section

Tags
Throws
UnauthorizedException

If the current user user is not allowed to create a section

Throws
InvalidArgumentException

If the new identifier already exists (if set in the update struct)