PHP Class eZ\Publish\Core\Persistence\Legacy\Content\Location\Handler

Inheritance: implements eZ\Publish\SPI\Persistence\Content\Location\Handler
Show file Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$contentHandler eZ\Publish\Core\Persistence\Legacy\Content\Handler Content handler.
$locationGateway Gateway Gateway for handling location data.
$locationMapper Mapper Location locationMapper.
$objectStateHandler eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler Object state handler.
$treeHandler eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler Tree handler.

Public Methods

Method Description
__construct ( Gateway $locationGateway, Mapper $locationMapper, Handler $contentHandler, Handler $objectStateHandler, TreeHandler $treeHandler ) : Handler Construct from userGateway.
changeMainLocation ( mixed $contentId, mixed $locationId ) Changes main location of content identified by given $contentId to location identified by given $locationId.
copySubtree ( mixed $sourceId, mixed $destinationParentId ) : eZ\Publish\SPI\Persistence\Content\Location Copy location object identified by $sourceId, into destination identified by $destinationParentId.
create ( eZ\Publish\SPI\Persistence\Content\Location\CreateStruct $createStruct ) : eZ\Publish\SPI\Persistence\Content\Location Creates a new location rooted at $location->parentId.
hide ( mixed $id ) Sets a location to be hidden, and it self + all children to invisible.
load ( integer $locationId ) : eZ\Publish\SPI\Persistence\Content\Location Loads the data for the location identified by $locationId.
loadByRemoteId ( string $remoteId ) : eZ\Publish\SPI\Persistence\Content\Location Loads the data for the location identified by $remoteId.
loadLocationsByContent ( integer $contentId, integer $rootLocationId = null ) : eZ\Publish\SPI\Persistence\Content\Location[] Loads all locations for $contentId, optionally limited to a sub tree identified by $rootLocationId.
loadParentLocationsForDraftContent ( $contentId )
loadSubtreeIds ( integer $locationId ) : array Loads the subtree ids of the location identified by $locationId.
markSubtreeModified ( integer | string $locationId, integer $timestamp = null ) Marks the given nodes and all ancestors as modified.
move ( mixed $sourceId, mixed $destinationParentId ) : boolean Moves location identified by $sourceId into new parent identified by $destinationParentId.
removeSubtree ( mixed $locationId ) : boolean Removes all Locations under and including $locationId.
setSectionForSubtree ( mixed $locationId, mixed $sectionId ) Set section on all content objects in the subtree.
swap ( mixed $locationId1, mixed $locationId2 ) : boolean Swaps the content object being pointed to by a location object.
unHide ( mixed $id ) Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree.
update ( eZ\Publish\SPI\Persistence\Content\Location\UpdateStruct $location, integer $locationId ) Updates an existing location.

Protected Methods

Method Description
getDefaultContentStates ( ) : eZ\Publish\SPI\Persistence\Content\ObjectState[] Returns an array of default content states with content state group id as key.
getParentPathString ( string $pathString ) : string Returns parent path string for a path string.
setContentStates ( eZ\Publish\SPI\Persistence\Content $content, array $contentStates )

Method Details

__construct() public method

Construct from userGateway.
public __construct ( Gateway $locationGateway, Mapper $locationMapper, Handler $contentHandler, Handler $objectStateHandler, TreeHandler $treeHandler ) : Handler
$locationGateway Gateway
$locationMapper Mapper
$contentHandler eZ\Publish\Core\Persistence\Legacy\Content\Handler
$objectStateHandler eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler
$treeHandler eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler
return Handler

changeMainLocation() public method

Updates ezcontentobject_tree and eznode_assignment tables (eznode_assignment for content current version number).
public changeMainLocation ( mixed $contentId, mixed $locationId )
$contentId mixed
$locationId mixed

copySubtree() public method

Performs a deep copy of the location identified by $sourceId and all of its child locations, copying the most recent published content object for each location to a new content object without any additional version information. Relations are not copied. URLs are not touched at all.
public copySubtree ( mixed $sourceId, mixed $destinationParentId ) : eZ\Publish\SPI\Persistence\Content\Location
$sourceId mixed
$destinationParentId mixed
return eZ\Publish\SPI\Persistence\Content\Location the newly created Location.

create() public method

Creates a new location rooted at $location->parentId.
public create ( eZ\Publish\SPI\Persistence\Content\Location\CreateStruct $createStruct ) : eZ\Publish\SPI\Persistence\Content\Location
$createStruct eZ\Publish\SPI\Persistence\Content\Location\CreateStruct
return eZ\Publish\SPI\Persistence\Content\Location

getDefaultContentStates() protected method

Returns an array of default content states with content state group id as key.
protected getDefaultContentStates ( ) : eZ\Publish\SPI\Persistence\Content\ObjectState[]
return eZ\Publish\SPI\Persistence\Content\ObjectState[]

getParentPathString() protected method

Returns parent path string for a path string.
protected getParentPathString ( string $pathString ) : string
$pathString string
return string

hide() public method

Sets a location to be hidden, and it self + all children to invisible.
public hide ( mixed $id )
$id mixed Location ID

load() public method

Loads the data for the location identified by $locationId.
public load ( integer $locationId ) : eZ\Publish\SPI\Persistence\Content\Location
$locationId integer
return eZ\Publish\SPI\Persistence\Content\Location

loadByRemoteId() public method

Loads the data for the location identified by $remoteId.
public loadByRemoteId ( string $remoteId ) : eZ\Publish\SPI\Persistence\Content\Location
$remoteId string
return eZ\Publish\SPI\Persistence\Content\Location

loadLocationsByContent() public method

Loads all locations for $contentId, optionally limited to a sub tree identified by $rootLocationId.
public loadLocationsByContent ( integer $contentId, integer $rootLocationId = null ) : eZ\Publish\SPI\Persistence\Content\Location[]
$contentId integer
$rootLocationId integer
return eZ\Publish\SPI\Persistence\Content\Location[]

loadParentLocationsForDraftContent() public method

See also: eZ\Publish\SPI\Persistence\Content\Location\Handler::loadParentLocationsForDraftContent
public loadParentLocationsForDraftContent ( $contentId )

loadSubtreeIds() public method

Loads the subtree ids of the location identified by $locationId.
public loadSubtreeIds ( integer $locationId ) : array
$locationId integer
return array Location ids are in the index, Content ids in the value.

markSubtreeModified() public method

Optionally a time stamp with the modification date may be specified, otherwise the current time is used.
public markSubtreeModified ( integer | string $locationId, integer $timestamp = null )
$locationId integer | string
$timestamp integer

move() public method

Performs a full move of the location identified by $sourceId to a new destination, identified by $destinationParentId. Relations do not need to be updated, since they refer to Content. URLs are not touched.
public move ( mixed $sourceId, mixed $destinationParentId ) : boolean
$sourceId mixed
$destinationParentId mixed
return boolean

removeSubtree() public method

Performs a recursive delete on the location identified by $locationId, including all of its child locations. Content which is not referred to by any other location is automatically removed. Content which looses its main Location will get the first of its other Locations assigned as the new main Location.
public removeSubtree ( mixed $locationId ) : boolean
$locationId mixed
return boolean

setContentStates() protected method

protected setContentStates ( eZ\Publish\SPI\Persistence\Content $content, array $contentStates )
$content eZ\Publish\SPI\Persistence\Content
$contentStates array

setSectionForSubtree() public method

Set section on all content objects in the subtree.
public setSectionForSubtree ( mixed $locationId, mixed $sectionId )
$locationId mixed
$sectionId mixed

swap() public method

Make the location identified by $locationId1 refer to the Content referred to by $locationId2 and vice versa.
public swap ( mixed $locationId1, mixed $locationId2 ) : boolean
$locationId1 mixed
$locationId2 mixed
return boolean

unHide() public method

If not make sure only children down to first hidden node is marked visible.
public unHide ( mixed $id )
$id mixed

update() public method

Updates an existing location.
public update ( eZ\Publish\SPI\Persistence\Content\Location\UpdateStruct $location, integer $locationId )
$location eZ\Publish\SPI\Persistence\Content\Location\UpdateStruct
$locationId integer

Property Details

$contentHandler protected property

Content handler.
protected Handler,eZ\Publish\Core\Persistence\Legacy\Content $contentHandler
return eZ\Publish\Core\Persistence\Legacy\Content\Handler

$locationGateway protected property

Gateway for handling location data.
protected Gateway,eZ\Publish\Core\Persistence\Legacy\Content\Location $locationGateway
return Gateway

$locationMapper protected property

Location locationMapper.
protected Mapper,eZ\Publish\Core\Persistence\Legacy\Content\Location $locationMapper
return Mapper

$objectStateHandler protected property

Object state handler.
protected Handler,eZ\Publish\Core\Persistence\Legacy\Content\ObjectState $objectStateHandler
return eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler

$treeHandler protected property

Tree handler.
protected TreeHandler,eZ\Publish\Core\Persistence\Legacy\Content $treeHandler
return eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler