-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-8534: Dropped deprecated Relation related methods usage
- Loading branch information
Showing
3 changed files
with
60 additions
and
15 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/lib/Pagination/Adapter/RelationListIteratorAdapter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\AdminUi\Pagination\Adapter; | ||
|
||
use Ibexa\Contracts\Core\Repository\ContentService; | ||
use Ibexa\Contracts\Core\Repository\Iterator\BatchIteratorAdapter; | ||
use Ibexa\Contracts\Core\Repository\Values\Content\RelationType; | ||
use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; | ||
use Iterator; | ||
use IteratorIterator; | ||
|
||
final class RelationListIteratorAdapter implements BatchIteratorAdapter | ||
{ | ||
public function __construct( | ||
readonly private ContentService $contentService, | ||
readonly private VersionInfo $versionInfo, | ||
readonly private ?RelationType $relationType = null, | ||
) { | ||
} | ||
|
||
public function fetch(int $offset, int $limit): Iterator | ||
{ | ||
$iterator = $this->contentService->loadRelationList( | ||
$this->versionInfo, | ||
$offset, | ||
$limit, | ||
$this->relationType | ||
)->getIterator(); | ||
|
||
if ($iterator instanceof Iterator) { | ||
return $iterator; | ||
} | ||
|
||
return new IteratorIterator($iterator); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters