eZPublishCommunityProject  2013.5
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway Class Reference

Base class for location gateways. More...

+ Inheritance diagram for eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway:

Public Member Functions

 changeMainLocation ($contentId, $locationId, $versionNo, $parentLocationId)
 Changes main location of content identified by given $contentId to location identified by given $locationId. More...
 
 cleanupTrash ()
 Removes every entries in the trash. More...
 
 countLocationsByContentId ($contentId)
 Returns how many locations given content object identified by $contentId has. More...
 
 create (CreateStruct $createStruct, array $parentNode)
 Creates a new location in given $parentNode. More...
 
 createLocationsFromNodeAssignments ($contentId, $versionNo)
 Create locations from node assignments. More...
 
 createNodeAssignment (CreateStruct $createStruct, $parentNodeId, $type=self::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP)
 Create an entry in the node assignment table. More...
 
 deleteNodeAssignment ($contentId, $versionNo=null)
 Deletes node assignment for given $contentId and $versionNo. More...
 
 getBasicNodeData ($nodeId)
 Returns an array with basic node data. More...
 
 getBasicNodeDataByRemoteId ($remoteId)
 Returns an array with basic node data for the node with $remoteId. More...
 
 getChildren ($locationId)
 Returns data for the first level children of the location identified by given $locationId. More...
 
 getFallbackMainNodeData ($contentId, $locationId)
 Returns id of the next in line node to be set as a new main node. More...
 
 getSubtreeContent ($sourceId)
 Find all content in the given subtree. More...
 
 hideSubtree ($pathString)
 Sets a location to be hidden, and it self + all children to invisible. More...
 
 listTrashed ($offset, $limit, array $sort=null)
 Lists trashed items. More...
 
 loadLocationDataByContent ($contentId, $rootLocationId=null)
 Loads data for all Locations for $contentId, optionally only in the subtree starting at $rootLocationId. More...
 
 loadParentLocationsDataForDraftContent ($contentId)
 Loads data for all parent Locations for unpublished Content by given $contentId. More...
 
 loadTrashByLocation ($locationId)
 Loads trash data specified by location ID. More...
 
 moveSubtreeNodes (array $fromPathString, array $toPathString)
 Update path strings to move nodes in the ezcontentobject_tree table. More...
 
 removeElementFromTrash ($id)
 Removes trashed element identified by $id from trash. More...
 
 removeLocation ($locationId)
 Deletes ezcontentobject_tree row for given $locationId (node_id) More...
 
 setSectionForSubtree ($pathString, $sectionId)
 Set section on all content objects in the subtree. More...
 
 swap ($locationId1, $locationId2)
 Swaps the content object being pointed to by a location object. More...
 
 trashLocation ($locationId)
 Sends a single location identified by given $locationId to the trash. More...
 
 unHideSubtree ($pathString)
 Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree. More...
 
 untrashLocation ($locationId, $newParentId=null)
 Returns a trashed location to normal state. More...
 
 update (UpdateStruct $location, $locationId)
 Updates an existing location. More...
 
 updateLocationsContentVersionNo ($contentId, $versionNo)
 Updates all Locations of content identified with $contentId with $versionNo. More...
 
 updateNodeAssignment ($contentObjectId, $oldParent, $newParent, $opcode)
 Update node assignment table. More...
 
 updatePathIdentificationString ($locationId, $parentLocationId, $text)
 Updates path identification string for given $locationId. More...
 
 updateSubtreeModificationTime ($pathString, $timestamp=null)
 Updated subtree modification time for all nodes on path. More...
 

Public Attributes

const NODE_ASSIGNMENT_OP_CODE_CREATE = 3
 
const NODE_ASSIGNMENT_OP_CODE_CREATE_NOP = 2
 
const NODE_ASSIGNMENT_OP_CODE_EXECUTE = 1
 
const NODE_ASSIGNMENT_OP_CODE_MOVE = 5
 
const NODE_ASSIGNMENT_OP_CODE_MOVE_NOP = 4
 
const NODE_ASSIGNMENT_OP_CODE_NOP = 0
 Constants for node assignment op codes. More...
 
const NODE_ASSIGNMENT_OP_CODE_REMOVE = 7
 
const NODE_ASSIGNMENT_OP_CODE_REMOVE_NOP = 6
 
const NODE_ASSIGNMENT_OP_CODE_SET = 9
 
const NODE_ASSIGNMENT_OP_CODE_SET_NOP = 8
 

Detailed Description

Base class for location gateways.

Member Function Documentation

eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::changeMainLocation (   $contentId,
  $locationId,
  $versionNo,
  $parentLocationId 
)
abstract

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

Updates ezcontentobject_tree table for the given $contentId and eznode_assignment table for the given $contentId, $parentLocationId and $versionNo

Parameters
mixed$contentId
mixed$locationId
mixed$versionNoversion number, needed to update eznode_assignment table
mixed$parentLocationIdparent location of location identified by $locationId, needed to update eznode_assignment table
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::cleanupTrash ( )
abstract

Removes every entries in the trash.

Will NOT remove associated content objects nor attributes.

Basically truncates ezcontentobject_trash table.

Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::countLocationsByContentId (   $contentId)
abstract

Returns how many locations given content object identified by $contentId has.

Parameters
int$contentId
Returns
int
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::create ( CreateStruct  $createStruct,
array  $parentNode 
)
abstract

Creates a new location in given $parentNode.

Parameters
\eZ\Publish\SPI\Persistence\Content\Location\CreateStruct$createStruct
array$parentNode
Returns

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\EzcDatabase\createLocationsFromNodeAssignments(), and eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\EzcDatabase\untrashLocation().

eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::createLocationsFromNodeAssignments (   $contentId,
  $versionNo 
)
abstract

Create locations from node assignments.

Convert existing node assignments into real locations.

Parameters
mixed$contentId
mixed$versionNo
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::createNodeAssignment ( CreateStruct  $createStruct,
  $parentNodeId,
  $type = self::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP 
)
abstract

Create an entry in the node assignment table.

Parameters
\eZ\Publish\SPI\Persistence\Content\Location\CreateStruct$createStruct
mixed$parentNodeId
int$type
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::deleteNodeAssignment (   $contentId,
  $versionNo = null 
)
abstract

Deletes node assignment for given $contentId and $versionNo.

Parameters
int$contentId
int$versionNo
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::getBasicNodeData (   $nodeId)
abstract

Returns an array with basic node data.

We might want to cache this, since this method is used by about every method in the location handler.

Todo:
optimize
Parameters
mixed$nodeId
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::getBasicNodeDataByRemoteId (   $remoteId)
abstract

Returns an array with basic node data for the node with $remoteId.

Todo:
optimize
Parameters
mixed$remoteId
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::getChildren (   $locationId)
abstract

Returns data for the first level children of the location identified by given $locationId.

Parameters
mixed$locationId
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::getFallbackMainNodeData (   $contentId,
  $locationId 
)
abstract

Returns id of the next in line node to be set as a new main node.

This returns lowest node id for content identified by $contentId, and not of the node identified by given $locationId (current main node). Assumes that content has more than one location.

Parameters
mixed$contentId
mixed$locationId
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::getSubtreeContent (   $sourceId)
abstract

Find all content in the given subtree.

Parameters
mixed$sourceId
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::hideSubtree (   $pathString)
abstract

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

Parameters
string$pathString
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::listTrashed (   $offset,
  $limit,
array  $sort = null 
)
abstract

Lists trashed items.

Returns entries from ezcontentobject_trash.

Parameters
int$offset
int$limit
array$sort
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::loadLocationDataByContent (   $contentId,
  $rootLocationId = null 
)
abstract

Loads data for all Locations for $contentId, optionally only in the subtree starting at $rootLocationId.

Parameters
int$contentId
int$rootLocationId
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::loadParentLocationsDataForDraftContent (   $contentId)
abstract

Loads data for all parent Locations for unpublished Content by given $contentId.

Parameters
mixed$contentId
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::loadTrashByLocation (   $locationId)
abstract

Loads trash data specified by location ID.

Parameters
mixed$locationId
Returns
array
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::moveSubtreeNodes ( array  $fromPathString,
array  $toPathString 
)
abstract

Update path strings to move nodes in the ezcontentobject_tree table.

This query can likely be optimized to use some more advanced string operations, which then depend on the respective database.

Todo:
optimize
Parameters
array$fromPathString
array$toPathString
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::removeElementFromTrash (   $id)
abstract

Removes trashed element identified by $id from trash.

Will NOT remove associated content object nor attributes.

Parameters
int$idThe trashed location Id
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::removeLocation (   $locationId)
abstract

Deletes ezcontentobject_tree row for given $locationId (node_id)

Parameters
mixed$locationId
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::setSectionForSubtree (   $pathString,
  $sectionId 
)
abstract

Set section on all content objects in the subtree.

Parameters
mixed$pathString
mixed$sectionId
Returns
boolean
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::swap (   $locationId1,
  $locationId2 
)
abstract

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
Returns
boolean
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::trashLocation (   $locationId)
abstract

Sends a single location identified by given $locationId to the trash.

The associated content object is left untouched.

Parameters
mixed$locationId
Returns
boolean
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::unHideSubtree (   $pathString)
abstract

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
string$pathString
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::untrashLocation (   $locationId,
  $newParentId = null 
)
abstract

Returns a trashed location to normal state.

Recreates the originally trashed location in the new position. If no new position has been specified, it will be tried to re-create the location at the old position. If this is not possible ( because the old location does not exist any more) and exception is thrown.

Parameters
mixed$locationId
mixed$newParentId
Returns
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::update ( UpdateStruct  $location,
  $locationId 
)
abstract

Updates an existing location.

Parameters
\eZ\Publish\SPI\Persistence\Content\Location\UpdateStruct$location
int$locationId
Returns
boolean
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::updateLocationsContentVersionNo (   $contentId,
  $versionNo 
)
abstract

Updates all Locations of content identified with $contentId with $versionNo.

Parameters
mixed$contentId
mixed$versionNo
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::updateNodeAssignment (   $contentObjectId,
  $oldParent,
  $newParent,
  $opcode 
)
abstract

Update node assignment table.

Parameters
int$contentObjectId
int$oldParent
int$newParent
int$opcode
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::updatePathIdentificationString (   $locationId,
  $parentLocationId,
  $text 
)
abstract

Updates path identification string for given $locationId.

Parameters
mixed$locationId
mixed$parentLocationId
string$text
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::updateSubtreeModificationTime (   $pathString,
  $timestamp = null 
)
abstract

Updated subtree modification time for all nodes on path.

Parameters
string$pathString
int | null$timestamp
Returns
void

Member Data Documentation

const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_CREATE = 3
const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP = 2
const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_EXECUTE = 1
const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_MOVE = 5
const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_MOVE_NOP = 4
const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_NOP = 0

Constants for node assignment op codes.

const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_REMOVE = 7
const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_REMOVE_NOP = 6
const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_SET = 9
const eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::NODE_ASSIGNMENT_OP_CODE_SET_NOP = 8

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