eZPublishCommunityProject  2013.9
eZ\Publish\Core\Repository\LocationService Class Reference
+ Inheritance diagram for eZ\Publish\Core\Repository\LocationService:
+ Collaboration diagram for eZ\Publish\Core\Repository\LocationService:

Public Member Functions

 __construct (RepositoryInterface $repository, Handler $handler, DomainMapper $domainMapper, NameSchemaService $nameSchemaService, array $settings=array())
 Setups service with reference to repository object that created it & corresponding handler. More...
 
 createLocation (ContentInfo $contentInfo, LocationCreateStruct $locationCreateStruct)
 Creates the new $location in the content repository for the given content. More...
 
 getLocationChildCount (APILocation $location)
 Returns the number of children which are readable by the current user of a location object. More...
 
 hideLocation (APILocation $location)
 Hides the $location and marks invisible all descendants of $location. More...
 
 loadLocation ($locationId)
 Loads a location object from its $locationId. More...
 
 loadLocationByRemoteId ($remoteId)
 Loads a location object from its $remoteId. More...
 
 loadLocationChildren (APILocation $location, $offset=0, $limit=-1)
 Loads children which are readable by the current user of a location object sorted by sortField and sortOrder. More...
 
 loadLocations (ContentInfo $contentInfo, APILocation $rootLocation=null)
 Loads the locations for the given content object. More...
 
 newLocationCreateStruct ($parentLocationId)
 Instantiates a new location create class. More...
 
 newLocationUpdateStruct ()
 Instantiates a new location update class. More...
 
 swapLocation (APILocation $location1, APILocation $location2)
 Swaps the contents held by $location1 and $location2. More...
 
 unhideLocation (APILocation $location)
 Unhides the $location. More...
 
 updateLocation (APILocation $location, LocationUpdateStruct $locationUpdateStruct)
 Updates $location in the content repository. More...
 
- Public Member Functions inherited from eZ\Publish\API\Repository\LocationService
 copySubtree (Location $subtree, Location $targetParentLocation)
 Copies the subtree starting from $subtree as a new subtree of $targetLocation. More...
 
 deleteLocation (Location $location)
 Deletes $location and all its descendants. More...
 
 getLocationChildCount (Location $location)
 Returns the number of children which are readable by the current user of a location object. More...
 
 hideLocation (Location $location)
 Hides the $location and marks invisible all descendants of $location. More...
 
 loadLocationChildren (Location $location, $offset=0, $limit=-1)
 Loads children which are readable by the current user of a location object sorted by sortField and sortOrder. More...
 
 loadLocations (ContentInfo $contentInfo, Location $rootLocation=null)
 Loads the locations for the given content object. More...
 
 moveSubtree (Location $location, Location $newParentLocation)
 Moves the subtree to $newParentLocation. More...
 
 swapLocation (Location $location1, Location $location2)
 Swaps the contents held by $location1 and $location2. More...
 
 unhideLocation (Location $location)
 Unhides the $location. More...
 
 updateLocation (Location $location, LocationUpdateStruct $locationUpdateStruct)
 Updates $location in the content repository. More...
 

Protected Member Functions

 buildDomainLocationObject (SPILocation $spiLocation)
 Builds domain location object from provided persistence location. More...
 
 getSortClauseBySortField ($sortField, $sortOrder=APILocation::SORT_ORDER_ASC)
 Instantiates a correct sort clause object based on provided location sort field and sort order. More...
 
 searchChildrenLocations ($parentLocationId, $sortField=null, $sortOrder=APILocation::SORT_ORDER_ASC, $offset=0, $limit=-1)
 Searches children locations of the provided parent location id. More...
 

Protected Attributes

 $domainMapper
 
 $nameSchemaService
 
 $persistenceHandler
 
 $repository
 
 $settings
 

Constructor & Destructor Documentation

eZ\Publish\Core\Repository\LocationService::__construct ( RepositoryInterface  $repository,
Handler  $handler,
DomainMapper  $domainMapper,
NameSchemaService  $nameSchemaService,
array  $settings = array() 
)

Setups service with reference to repository object that created it & corresponding handler.

Parameters
\eZ\Publish\API\Repository\Repository$repository
\eZ\Publish\SPI\Persistence\Handler$handler
\eZ\Publish\Core\Repository\DomainMapper$domainMapper
\eZ\Publish\Core\Repository\NameSchemaService$nameSchemaService
array$settings

Member Function Documentation

eZ\Publish\Core\Repository\LocationService::buildDomainLocationObject ( SPILocation  $spiLocation)
protected
eZ\Publish\Core\Repository\LocationService::createLocation ( ContentInfo  $contentInfo,
LocationCreateStruct  $locationCreateStruct 
)

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionIf the current user user is not allowed to create this location
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif 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
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
\eZ\Publish\API\Repository\Values\Content\LocationCreateStruct$locationCreateStruct
Returns
the newly created Location

Implements eZ\Publish\API\Repository\LocationService.

eZ\Publish\Core\Repository\LocationService::getLocationChildCount ( APILocation  $location)

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

Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
Returns
int
eZ\Publish\Core\Repository\LocationService::getSortClauseBySortField (   $sortField,
  $sortOrder = APILocation::SORT_ORDER_ASC 
)
protected

Instantiates a correct sort clause object based on provided location sort field and sort order.

Parameters
int$sortField
int$sortOrder
Returns

Referenced by eZ\Publish\Core\Repository\LocationService\searchChildrenLocations().

eZ\Publish\Core\Repository\LocationService::hideLocation ( APILocation  $location)

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionIf the current user user is not allowed to hide this location
Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
Returns
$location, with updated hidden value
eZ\Publish\Core\Repository\LocationService::loadLocation (   $locationId)

Loads a location object from its $locationId.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionIf the current user user is not allowed to read this location
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf the specified location is not found
Parameters
mixed$locationId
Returns

Implements eZ\Publish\API\Repository\LocationService.

Referenced by eZ\Publish\Core\Repository\LocationService\createLocation(), eZ\Publish\Core\Repository\LocationService\hideLocation(), eZ\Publish\Core\Repository\LocationService\swapLocation(), eZ\Publish\Core\Repository\LocationService\unhideLocation(), and eZ\Publish\Core\Repository\LocationService\updateLocation().

eZ\Publish\Core\Repository\LocationService::loadLocationByRemoteId (   $remoteId)

Loads a location object from its $remoteId.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionIf the current user user is not allowed to read this location
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionIf more than one location with same remote ID was found
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf the specified location is not found
Parameters
string$remoteId
Returns

Implements eZ\Publish\API\Repository\LocationService.

Referenced by eZ\Publish\Core\Repository\LocationService\updateLocation().

eZ\Publish\Core\Repository\LocationService::loadLocationChildren ( APILocation  $location,
  $offset = 0,
  $limit = -1 
)

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

Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
int$offsetthe start offset for paging
int$limitthe number of locations returned. If $limit = -1 all children starting at $offset are returned
Returns
eZ\Publish\Core\Repository\LocationService::loadLocations ( ContentInfo  $contentInfo,
APILocation  $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.

Todo:
permissions check is missing
Exceptions
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionif there is no published version yet
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
\eZ\Publish\API\Repository\Values\Content\Location$rootLocation
Returns
[] An array of Location

Referenced by eZ\Publish\Core\Repository\LocationService\createLocation().

eZ\Publish\Core\Repository\LocationService::newLocationCreateStruct (   $parentLocationId)

Instantiates a new location create class.

Parameters
mixed$parentLocationIdthe parent under which the new location should be created
Returns

Implements eZ\Publish\API\Repository\LocationService.

eZ\Publish\Core\Repository\LocationService::newLocationUpdateStruct ( )

Instantiates a new location update class.

Returns

Implements eZ\Publish\API\Repository\LocationService.

eZ\Publish\Core\Repository\LocationService::searchChildrenLocations (   $parentLocationId,
  $sortField = null,
  $sortOrder = APILocation::SORT_ORDER_ASC,
  $offset = 0,
  $limit = -1 
)
protected

Searches children locations of the provided parent location id.

Parameters
mixed$parentLocationId
int$sortField
int$sortOrder
int$offset
int$limit
Returns

Referenced by eZ\Publish\Core\Repository\LocationService\getLocationChildCount(), and eZ\Publish\Core\Repository\LocationService\loadLocationChildren().

eZ\Publish\Core\Repository\LocationService::swapLocation ( APILocation  $location1,
APILocation  $location2 
)

Swaps the contents held by $location1 and $location2.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionIf the current user user is not allowed to swap content
Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location1
\eZ\Publish\API\Repository\Values\Content\Location$location2
eZ\Publish\Core\Repository\LocationService::unhideLocation ( APILocation  $location)

Unhides the $location.

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionIf the current user user is not allowed to unhide this location
Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
Returns
$location, with updated hidden value
eZ\Publish\Core\Repository\LocationService::updateLocation ( APILocation  $location,
LocationUpdateStruct  $locationUpdateStruct 
)

Updates $location in the content repository.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionIf the current user user is not allowed to update this location
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif if set the remoteId exists already
Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
\eZ\Publish\API\Repository\Values\Content\LocationUpdateStruct$locationUpdateStruct
Returns
the updated Location

Member Data Documentation

eZ\Publish\Core\Repository\LocationService::$domainMapper
protected
eZ\Publish\Core\Repository\LocationService::$nameSchemaService
protected
eZ\Publish\Core\Repository\LocationService::$persistenceHandler
protected
eZ\Publish\Core\Repository\LocationService::$repository
protected
eZ\Publish\Core\Repository\LocationService::$settings
protected

The documentation for this class was generated from the following file: