Class

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

class Handler implements Handler

The Location Handler interface defines operations on Location elements in the storage engine.

Methods

Handler __construct(Gateway $locationGateway, Mapper $locationMapper, Handler $contentHandler, Handler $objectStateHandler, TreeHandler $treeHandler)

Construct from userGateway.

Location load(int $locationId)

Loads the data for the location identified by $locationId.

array loadSubtreeIds(int $locationId)

Loads the subtree ids of the location identified by $locationId.

Location loadByRemoteId(string $remoteId)

Loads the data for the location identified by $remoteId.

Location[] loadLocationsByContent(int $contentId, int $rootLocationId = null)

Loads all locations for $contentId, optionally limited to a sub tree identified by $rootLocationId.

Location[] loadParentLocationsForDraftContent(mixed $contentId)

Location copySubtree(mixed $sourceId, mixed $destinationParentId)

Copy location object identified by $sourceId, into destination identified by $destinationParentId.

bool move(mixed $sourceId, mixed $destinationParentId)

Moves location identified by $sourceId into new parent identified by $destinationParentId.

markSubtreeModified(int|string $locationId, int $timestamp = null)

Marks the given nodes and all ancestors as modified.

hide(mixed $id)

Sets a location to be hidden, and it self + all children to invisible.

unHide(mixed $id)

Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree.

bool swap(mixed $locationId1, mixed $locationId2)

Swaps the content object being pointed to by a location object.

update(UpdateStruct $location, int $locationId)

Updates an existing location.

Location create(CreateStruct $createStruct)

Creates a new location rooted at $location->parentId.

bool removeSubtree(mixed $locationId)

Removes all Locations under and including $locationId.

setSectionForSubtree(mixed $locationId, mixed $sectionId)

Set section on all content objects in the subtree.

changeMainLocation(mixed $contentId, mixed $locationId)

Changes main location of content identified by given $contentId to location identified by given $locationId.

Details

at line 74
public Handler __construct(Gateway $locationGateway, Mapper $locationMapper, Handler $contentHandler, Handler $objectStateHandler, TreeHandler $treeHandler)

Construct from userGateway.

Parameters

Gateway $locationGateway
Mapper $locationMapper
Handler $contentHandler
Handler $objectStateHandler
TreeHandler $treeHandler

Return Value

Handler

at line 107
public Location load(int $locationId)

Loads the data for the location identified by $locationId.

Parameters

int $locationId

Return Value

Location

at line 119
public array loadSubtreeIds(int $locationId)

Loads the subtree ids of the location identified by $locationId.

Parameters

int $locationId

Return Value

array Location ids are in the index, Content ids in the value.

at line 133
public Location loadByRemoteId(string $remoteId)

Loads the data for the location identified by $remoteId.

Parameters

string $remoteId

Return Value

Location

Exceptions

NotFoundException

at line 149
public Location[] loadLocationsByContent(int $contentId, int $rootLocationId = null)

Loads all locations for $contentId, optionally limited to a sub tree identified by $rootLocationId.

Parameters

int $contentId
int $rootLocationId

Return Value

Location[]

at line 159
public Location[] loadParentLocationsForDraftContent(mixed $contentId)

Parameters

mixed $contentId

Return Value

Location[]

See also

\eZ\Publish\SPI\Persistence\Content\Location\Handler::loadParentLocationsForDraftContent

at line 217
public Location copySubtree(mixed $sourceId, mixed $destinationParentId)

Copy location object identified by $sourceId, into destination identified by $destinationParentId.

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.

Parameters

mixed $sourceId
mixed $destinationParentId

Return Value

Location the newly created Location.

at line 373
public bool move(mixed $sourceId, mixed $destinationParentId)

Moves location identified by $sourceId into new parent identified by $destinationParentId.

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.

Parameters

mixed $sourceId
mixed $destinationParentId

Return Value

bool

at line 404
public markSubtreeModified(int|string $locationId, int $timestamp = null)

Marks the given nodes and all ancestors as modified.

Optionally a time stamp with the modification date may be specified, otherwise the current time is used.

Parameters

int|string $locationId
int $timestamp

at line 416
public hide(mixed $id)

Sets a location to be hidden, and it self + all children to invisible.

Parameters

mixed $id Location ID

at line 429
public unHide(mixed $id)

Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree.

If not make sure only children down to first hidden node is marked visible.

Parameters

mixed $id

at line 447
public bool swap(mixed $locationId1, mixed $locationId2)

Swaps the content object being pointed to by a location object.

Make the location identified by $locationId1 refer to the Content referred to by $locationId2 and vice versa.

Parameters

mixed $locationId1
mixed $locationId2

Return Value

bool

at line 458
public update(UpdateStruct $location, int $locationId)

Updates an existing location.

Parameters

UpdateStruct $location
int $locationId

at line 470
public Location create(CreateStruct $createStruct)

Creates a new location rooted at $location->parentId.

Parameters

CreateStruct $createStruct

Return Value

Location

at line 496
public bool removeSubtree(mixed $locationId)

Removes all Locations under and including $locationId.

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.

Parameters

mixed $locationId

Return Value

bool

at line 507
public setSectionForSubtree(mixed $locationId, mixed $sectionId)

Set section on all content objects in the subtree.

Parameters

mixed $locationId
mixed $sectionId

at line 520
public changeMainLocation(mixed $contentId, mixed $locationId)

Changes main location of content identified by given $contentId to location identified by given $locationId.

Updates ezcontentobjecttree and eznodeassignment tables (eznode_assignment for content current version number).

Parameters

mixed $contentId
mixed $locationId