| @@ 125-147 (lines=23) @@ | ||
| 122 | * |
|
| 123 | * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[] |
|
| 124 | */ |
|
| 125 | public function listVersions($contentId, $status = null, $limit = -1) |
|
| 126 | { |
|
| 127 | $rows = $this->contentGateway->listVersions($contentId, $status, $limit); |
|
| 128 | if (empty($rows)) { |
|
| 129 | return array(); |
|
| 130 | } |
|
| 131 | ||
| 132 | $idVersionPairs = array_map( |
|
| 133 | function ($row) use ($contentId) { |
|
| 134 | return array( |
|
| 135 | 'id' => $contentId, |
|
| 136 | 'version' => $row['ezcontentobject_version_version'], |
|
| 137 | ); |
|
| 138 | }, |
|
| 139 | $rows |
|
| 140 | ); |
|
| 141 | $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs); |
|
| 142 | ||
| 143 | return $this->contentMapper->extractVersionInfoListFromRows( |
|
| 144 | $rows, |
|
| 145 | $nameRows |
|
| 146 | ); |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * Loads the data for the location identified by $locationId. |
|
| @@ 457-476 (lines=20) @@ | ||
| 454 | * |
|
| 455 | * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[] |
|
| 456 | */ |
|
| 457 | public function loadDraftsForUser($userId) |
|
| 458 | { |
|
| 459 | $rows = $this->contentGateway->listVersionsForUser($userId, VersionInfo::STATUS_DRAFT); |
|
| 460 | if (empty($rows)) { |
|
| 461 | return array(); |
|
| 462 | } |
|
| 463 | ||
| 464 | $idVersionPairs = array_map( |
|
| 465 | function ($row) { |
|
| 466 | return array( |
|
| 467 | 'id' => $row['ezcontentobject_version_contentobject_id'], |
|
| 468 | 'version' => $row['ezcontentobject_version_version'], |
|
| 469 | ); |
|
| 470 | }, |
|
| 471 | $rows |
|
| 472 | ); |
|
| 473 | $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs); |
|
| 474 | ||
| 475 | return $this->mapper->extractVersionInfoListFromRows($rows, $nameRows); |
|
| 476 | } |
|
| 477 | ||
| 478 | /** |
|
| 479 | * Sets the status of object identified by $contentId and $version to $status. |
|