eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper::createLocationFromRow PHP Method

createLocationFromRow() public method

$prefix can be used to define a table prefix for the location table. Optionally pass a Location object, which will be filled with the values.
public createLocationFromRow ( array $data, string $prefix = '', eZ\Publish\SPI\Persistence\Content\Location $location = null ) : eZ\Publish\SPI\Persistence\Content\Location
$data array
$prefix string
$location eZ\Publish\SPI\Persistence\Content\Location
return eZ\Publish\SPI\Persistence\Content\Location
    public function createLocationFromRow(array $data, $prefix = '', Location $location = null)
    {
        $location = $location ?: new Location();
        $location->id = (int) $data[$prefix . 'node_id'];
        $location->priority = (int) $data[$prefix . 'priority'];
        $location->hidden = (bool) $data[$prefix . 'is_hidden'];
        $location->invisible = (bool) $data[$prefix . 'is_invisible'];
        $location->remoteId = $data[$prefix . 'remote_id'];
        $location->contentId = (int) $data[$prefix . 'contentobject_id'];
        $location->parentId = (int) $data[$prefix . 'parent_node_id'];
        $location->pathIdentificationString = $data[$prefix . 'path_identification_string'];
        $location->pathString = $data[$prefix . 'path_string'];
        $location->depth = (int) $data[$prefix . 'depth'];
        $location->sortField = (int) $data[$prefix . 'sort_field'];
        $location->sortOrder = (int) $data[$prefix . 'sort_order'];
        return $location;
    }

Usage Example

Beispiel #1
0
 /**
  * Returns an array of all trashed locations satisfying the $criterion (if provided),
  * sorted with SortClause objects contained in $sort (if any).
  * If no criterion is provided (null), no filter is applied
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param int $offset Offset to start listing from, 0 by default
  * @param int $limit Limit for the listing. Null by default (no limit)
  * @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause[] $sort
  *
  * @return \eZ\Publish\SPI\Persistence\Content\Location\Trashed[]
  */
 public function findTrashItems(Criterion $criterion = null, $offset = 0, $limit = null, array $sort = null)
 {
     // CBA: Ignore criterion for now.
     $rows = $this->locationGateway->listTrashed($offset, $limit, $sort);
     $items = array();
     foreach ($rows as $row) {
         $items[] = $this->locationMapper->createLocationFromRow($row, null, new Trashed());
     }
     return $items;
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper::createLocationFromRow