| @@ 127-149 (lines=23) @@ | ||
| 124 | * |
|
| 125 | * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[] |
|
| 126 | */ |
|
| 127 | public function listVersions($contentId, $status = null, $limit = -1) |
|
| 128 | { |
|
| 129 | $rows = $this->contentGateway->listVersions($contentId, $status, $limit); |
|
| 130 | if (empty($rows)) { |
|
| 131 | return array(); |
|
| 132 | } |
|
| 133 | ||
| 134 | $idVersionPairs = array_map( |
|
| 135 | function ($row) use ($contentId) { |
|
| 136 | return array( |
|
| 137 | 'id' => $contentId, |
|
| 138 | 'version' => $row['ezcontentobject_version_version'], |
|
| 139 | ); |
|
| 140 | }, |
|
| 141 | $rows |
|
| 142 | ); |
|
| 143 | $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs); |
|
| 144 | ||
| 145 | return $this->contentMapper->extractVersionInfoListFromRows( |
|
| 146 | $rows, |
|
| 147 | $nameRows |
|
| 148 | ); |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * Loads the data for the location identified by $locationId. |
|
| @@ 480-499 (lines=20) @@ | ||
| 477 | * |
|
| 478 | * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[] |
|
| 479 | */ |
|
| 480 | public function loadDraftsForUser($userId) |
|
| 481 | { |
|
| 482 | $rows = $this->contentGateway->listVersionsForUser($userId, VersionInfo::STATUS_DRAFT); |
|
| 483 | if (empty($rows)) { |
|
| 484 | return array(); |
|
| 485 | } |
|
| 486 | ||
| 487 | $idVersionPairs = array_map( |
|
| 488 | function ($row) { |
|
| 489 | return array( |
|
| 490 | 'id' => $row['ezcontentobject_version_contentobject_id'], |
|
| 491 | 'version' => $row['ezcontentobject_version_version'], |
|
| 492 | ); |
|
| 493 | }, |
|
| 494 | $rows |
|
| 495 | ); |
|
| 496 | $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs); |
|
| 497 | ||
| 498 | return $this->mapper->extractVersionInfoListFromRows($rows, $nameRows); |
|
| 499 | } |
|
| 500 | ||
| 501 | /** |
|
| 502 | * Sets the status of object identified by $contentId and $version to $status. |
|