Class

eZ\Publish\Core\SignalSlot\SectionService

class SectionService implements SectionService

SectionService class.

Methods

__construct(SectionService $service, SignalDispatcher $signalDispatcher)

Constructor.

Section createSection(SectionCreateStruct $sectionCreateStruct)

Creates the a new Section in the content repository.

Section updateSection(Section $section, SectionUpdateStruct $sectionUpdateStruct)

Updates the given in the content repository.

Section loadSection(mixed $sectionId)

Loads a Section from its id ($sectionId).

array loadSections()

Loads all sections.

Section loadSectionByIdentifier(string $sectionIdentifier)

Loads a Section from its identifier ($sectionIdentifier).

int countAssignedContents(Section $section)

Counts the contents which $section is assigned to.

bool isSectionUsed(Section $section)

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

assignSection(ContentInfo $contentInfo, Section $section)

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

deleteSection(Section $section)

Deletes $section from content repository.

SectionCreateStruct newSectionCreateStruct()

Instantiates a new SectionCreateStruct.

SectionUpdateStruct newSectionUpdateStruct()

Instantiates a new SectionUpdateStruct.

Details

at line 49
public __construct(SectionService $service, SignalDispatcher $signalDispatcher)

Constructor.

Construct service object from aggregated service and signal dispatcher

Parameters

SectionService $service
SignalDispatcher $signalDispatcher

at line 65
public Section createSection(SectionCreateStruct $sectionCreateStruct)

Creates the a new Section in the content repository.

Parameters

SectionCreateStruct $sectionCreateStruct

Return Value

Section The newly create section

Exceptions

UnauthorizedException If the current user user is not allowed to create a section
InvalidArgumentException If the new identifier in $sectionCreateStruct already exists

at line 90
public Section updateSection(Section $section, SectionUpdateStruct $sectionUpdateStruct)

Updates the given in the content repository.

Parameters

Section $section
SectionUpdateStruct $sectionUpdateStruct

Return Value

Section

Exceptions

UnauthorizedException If the current user user is not allowed to create a section
InvalidArgumentException If the new identifier already exists (if set in the update struct)

at line 114
public Section loadSection(mixed $sectionId)

Loads a Section from its id ($sectionId).

Parameters

mixed $sectionId

Return Value

Section

Exceptions

NotFoundException if section could not be found
UnauthorizedException If the current user user is not allowed to read a section

at line 126
public array loadSections()

Loads all sections.

Return Value

array of {@link \eZ\Publish\API\Repository\Values\Content\Section}

Exceptions

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

at line 141
public Section loadSectionByIdentifier(string $sectionIdentifier)

Loads a Section from its identifier ($sectionIdentifier).

Parameters

string $sectionIdentifier

Return Value

Section

Exceptions

NotFoundException if section could not be found
UnauthorizedException If the current user user is not allowed to read a section

at line 155
public int countAssignedContents(Section $section)

Counts the contents which $section is assigned to.

Parameters

Section $section

Return Value

int

at line 171
public bool isSectionUsed(Section $section)

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

This does not check user permissions.

Parameters

Section $section

Return Value

bool

at line 185
public assignSection(ContentInfo $contentInfo, Section $section)

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

Parameters

ContentInfo $contentInfo
Section $section

Exceptions

UnauthorizedException If user does not have access to view provided object

at line 210
public deleteSection(Section $section)

Deletes $section from content repository.

Parameters

Section $section

Exceptions

NotFoundException If the specified section is not found
UnauthorizedException If the current user user is not allowed to delete a section
BadStateException if section can not be deleted because it is still assigned to some contents.

at line 229
public SectionCreateStruct newSectionCreateStruct()

Instantiates a new SectionCreateStruct.

Return Value

SectionCreateStruct

at line 239
public SectionUpdateStruct newSectionUpdateStruct()

Instantiates a new SectionUpdateStruct.

Return Value

SectionUpdateStruct