Interface

eZ\Publish\API\Repository\LocationService

interface LocationService

Location service, used for complex subtree operations.

Methods

Location copySubtree(Location $subtree, Location $targetParentLocation)

Copies the subtree starting from $subtree as a new subtree of $targetLocation.

Location loadLocation(mixed $locationId)

Loads a location object from its $locationId.

Location loadLocationByRemoteId(string $remoteId)

Loads a location object from its $remoteId.

Location[] loadLocations(ContentInfo $contentInfo, Location $rootLocation = null)

Loads the locations for the given content object.

LocationList loadLocationChildren(Location $location, int $offset, int $limit = 25)

Loads children which are readable by the current user of a location object sorted by sortField and sortOrder.

Location[] loadParentLocationsForDraftContent(VersionInfo $versionInfo)

Load parent Locations for Content Draft.

int getLocationChildCount(Location $location)

Returns the number of children which are readable by the current user of a location object.

Location createLocation(ContentInfo $contentInfo, LocationCreateStruct $locationCreateStruct)

Creates the new $location in the content repository for the given content.

Location updateLocation(Location $location, LocationUpdateStruct $locationUpdateStruct)

Updates $location in the content repository.

swapLocation(Location $location1, Location $location2)

Swaps the contents held by $location1 and $location2.

Location hideLocation(Location $location)

Hides the $location and marks invisible all descendants of $location.

Location unhideLocation(Location $location)

Unhides the $location.

moveSubtree(Location $location, Location $newParentLocation)

Moves the subtree to $newParentLocation.

deleteLocation(Location $location)

Deletes $location and all its descendants.

LocationCreateStruct newLocationCreateStruct(mixed $parentLocationId)

Instantiates a new location create class.

LocationUpdateStruct newLocationUpdateStruct()

Instantiates a new location update class.

Details

at line 38
public Location copySubtree(Location $subtree, Location $targetParentLocation)

Copies the subtree starting from $subtree as a new subtree of $targetLocation.

Only the items on which the user has read access are copied.

Parameters

Location $subtree
  • the subtree denoted by the location to copy
Location $targetParentLocation
  • the target parent location for the copy operation

Return Value

Location The newly created location of the copied subtree

Exceptions

UnauthorizedException If the current user user is not allowed copy the subtree to the given parent location
UnauthorizedException If the current user user does not have read access to the whole source subtree
InvalidArgumentException if the target location is a sub location of the given location

at line 50
public Location loadLocation(mixed $locationId)

Loads a location object from its $locationId.

Parameters

mixed $locationId

Return Value

Location

Exceptions

UnauthorizedException If the current user user is not allowed to read this location
NotFoundException If the specified location is not found

at line 62
public Location loadLocationByRemoteId(string $remoteId)

Loads a location object from its $remoteId.

Parameters

string $remoteId

Return Value

Location

Exceptions

UnauthorizedException If the current user user is not allowed to read this location
NotFoundException If the specified location is not found

at line 77
public Location[] loadLocations(ContentInfo $contentInfo, Location $rootLocation = null)

Loads the locations for the given content object.

If a $rootLocation is given, only locations that belong to this location are returned. The location list is also filtered by permissions on reading locations.

Parameters

ContentInfo $contentInfo
Location $rootLocation

Return Value

Location[] An array of {@link Location}

Exceptions

BadStateException if there is no published version yet

at line 88
public LocationList loadLocationChildren(Location $location, int $offset, int $limit = 25)

Loads children which are readable by the current user of a location object sorted by sortField and sortOrder.

Parameters

Location $location
int $offset the start offset for paging
int $limit the number of locations returned

Return Value

LocationList

at line 97
public Location[] loadParentLocationsForDraftContent(VersionInfo $versionInfo)

Load parent Locations for Content Draft.

Parameters

VersionInfo $versionInfo

Return Value

Location[] List of parent Locations

at line 106
public int getLocationChildCount(Location $location)

Returns the number of children which are readable by the current user of a location object.

Parameters

Location $location

Return Value

int

at line 121
public Location createLocation(ContentInfo $contentInfo, LocationCreateStruct $locationCreateStruct)

Creates the new $location in the content repository for the given content.

Parameters

ContentInfo $contentInfo
LocationCreateStruct $locationCreateStruct

Return Value

Location the newly created Location

Exceptions

UnauthorizedException If the current user user is not allowed to create this location
InvalidArgumentException if the content is already below the specified parent or the parent is a sub location of the location of the content or if set the remoteId exists already

at line 134
public Location updateLocation(Location $location, LocationUpdateStruct $locationUpdateStruct)

Updates $location in the content repository.

Parameters

Location $location
LocationUpdateStruct $locationUpdateStruct

Return Value

Location the updated Location

Exceptions

UnauthorizedException If the current user user is not allowed to update this location
InvalidArgumentException if if set the remoteId exists already

at line 144
public swapLocation(Location $location1, Location $location2)

Swaps the contents held by $location1 and $location2.

Parameters

Location $location1
Location $location2

Exceptions

UnauthorizedException If the current user user is not allowed to swap content

at line 155
public Location hideLocation(Location $location)

Hides the $location and marks invisible all descendants of $location.

Parameters

Location $location

Return Value

Location $location, with updated hidden value

Exceptions

UnauthorizedException If the current user user is not allowed to hide this location

at line 169
public Location unhideLocation(Location $location)

Unhides the $location.

This method and marks visible all descendants of $locations until a hidden location is found.

Parameters

Location $location

Return Value

Location $location, with updated hidden value

Exceptions

UnauthorizedException If the current user user is not allowed to unhide this location

at line 184
public moveSubtree(Location $location, Location $newParentLocation)

Moves the subtree to $newParentLocation.

If a user has the permission to move the location to a target location he can do it regardless of an existing descendant on which the user has no permission.

Parameters

Location $location
Location $newParentLocation

Exceptions

UnauthorizedException If the current user user is not allowed to move this location to the target
UnauthorizedException If the current user user does not have read access to the whole source subtree
InvalidArgumentException if the new parent is in a subtree of the location

at line 193
public deleteLocation(Location $location)

Deletes $location and all its descendants.

Parameters

Location $location

Exceptions

UnauthorizedException If the current user is not allowed to delete this location or a descendant

at line 202
public LocationCreateStruct newLocationCreateStruct(mixed $parentLocationId)

Instantiates a new location create class.

Parameters

mixed $parentLocationId the parent under which the new location should be created

Return Value

LocationCreateStruct

at line 209
public LocationUpdateStruct newLocationUpdateStruct()

Instantiates a new location update class.

Return Value

LocationUpdateStruct