Skip to content

Commit 5ddc195

Browse files
committed
Refactor paginator namespace and update imports to align with core domain structure
1 parent 8918d78 commit 5ddc195

10 files changed

Lines changed: 12 additions & 149 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"require": {
88
"php": ">=8.4",
99
"doctrine/collections": "^2.6|^3.0",
10+
"open-solid/core": "^0.3.1",
1011
"symfony/console": "^7.4|^8.0",
1112
"symfony/framework-bundle": "^7.4|^8.0",
1213
"symfony/json-streamer": "^7.4|^8.0",
@@ -16,7 +17,6 @@
1617
},
1718
"require-dev": {
1819
"open-solid/callable-invoker": "^0.2.1",
19-
"open-solid/core": "^0.3.0",
2020
"phpunit/phpunit": "^13.0",
2121
"symfony/validator": "^8.0"
2222
},

docs/pagination.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The bundle provides built-in support for paginated collection endpoints with a s
55
## The Paginator Interface
66

77
```php
8-
namespace OpenSolid\Api\Controller\Model\Paginator;
8+
namespace OpenSolid\Core\Domain\Repository;
99

1010
/**
1111
* @template T of object
@@ -24,7 +24,7 @@ interface Paginator extends \Traversable, \Countable
2424
A concrete implementation that works with Doctrine's `Selectable` interface (e.g. Doctrine Collections, Repositories):
2525

2626
```php
27-
use OpenSolid\Api\Controller\Model\Paginator\SelectablePaginator;
27+
use OpenSolid\Core\Domain\Repository\SelectablePaginator;
2828

2929
$paginator = new SelectablePaginator(
3030
selectable: $repository, // Any Selectable & Countable
@@ -49,8 +49,9 @@ $paginator = new SelectablePaginator(
4949
Use `#[GetCollection]` with a `Paginator` return type:
5050

5151
```php
52-
use OpenSolid\Api\Controller\Model\Paginator\Paginator;
5352
use OpenSolid\Api\Routing\Attribute\GetCollection;
53+
use OpenSolid\Core\Domain\Repository\Paginator;
54+
use OpenSolid\Core\Domain\Repository\SelectablePaginator;
5455
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
5556

5657
#[GetCollection(

src/Controller/Decorator/ApiPaginationDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
namespace OpenSolid\Api\Controller\Decorator;
66

77
use OpenSolid\Api\Controller\Model\Paginator\PageResponse;
8-
use OpenSolid\Api\Controller\Model\Paginator\Paginator;
98
use OpenSolid\Api\Controller\Model\ResponseOptions;
109
use OpenSolid\CallableInvoker\CallableMetadata;
1110
use OpenSolid\CallableInvoker\Decorator\CallableClosure;
11+
use OpenSolid\Core\Domain\Repository\Paginator;
1212
use Symfony\Component\HttpFoundation\Request;
1313
use Symfony\Component\TypeInfo\Type;
1414

src/Controller/Model/Paginator/Paginator.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/Controller/Model/Paginator/SelectablePaginator.php

Lines changed: 0 additions & 105 deletions
This file was deleted.

src/OpenApi/Processor/AugmentOperations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
use OpenApi\Annotations as OA;
99
use OpenApi\Context;
1010
use OpenApi\Generator;
11-
use OpenSolid\Api\Controller\Model\Paginator\Paginator;
1211
use OpenSolid\Api\OpenApi\Schema\PaginatorSchema;
1312
use OpenSolid\Api\Routing\Attribute\ApiRoute;
1413
use OpenSolid\Core\Domain\Model\GetOrCreateResource;
14+
use OpenSolid\Core\Domain\Repository\Paginator;
1515
use Symfony\Component\HttpFoundation\Response;
1616
use Symfony\Component\TypeInfo\Type\CollectionType;
1717
use Symfony\Component\TypeInfo\Type\GenericType;

tests/Fixtures/App/Controller/FindOrdersByProductController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace OpenSolid\Api\Tests\Fixtures\App\Controller;
66

7-
use OpenSolid\Api\Controller\Model\Paginator\Paginator;
87
use OpenSolid\Api\Routing\Attribute\GetCollection;
98
use OpenSolid\Api\Tests\Fixtures\App\Model\FindOrdersByProductQuery;
109
use OpenSolid\Api\Tests\Fixtures\App\Model\OrderView;
10+
use OpenSolid\Core\Domain\Repository\Paginator;
1111
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
1212

1313
#[GetCollection(

tests/Fixtures/App/Controller/FindOrdersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace OpenSolid\Api\Tests\Fixtures\App\Controller;
66

7-
use OpenSolid\Api\Controller\Model\Paginator\Paginator;
87
use OpenSolid\Api\Routing\Attribute\GetCollection;
98
use OpenSolid\Api\Tests\Fixtures\App\Model\FindOrdersQuery;
109
use OpenSolid\Api\Tests\Fixtures\App\Model\OrderView;
10+
use OpenSolid\Core\Domain\Repository\Paginator;
1111
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
1212

1313
#[GetCollection(

tests/Fixtures/App/Controller/FindProductsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace OpenSolid\Api\Tests\Fixtures\App\Controller;
66

7-
use OpenSolid\Api\Controller\Model\Paginator\Paginator;
87
use OpenSolid\Api\Routing\Attribute\GetCollection;
98
use OpenSolid\Api\Tests\Fixtures\App\Model\FindProductsQuery;
109
use OpenSolid\Api\Tests\Fixtures\App\Model\ProductView;
10+
use OpenSolid\Core\Domain\Repository\Paginator;
1111
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
1212

1313
#[GetCollection(

tests/OpenApi/Processor/AugmentOperationsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
use OpenApi\Annotations as OA;
99
use OpenApi\Context;
1010
use OpenApi\Generator;
11-
use OpenSolid\Api\Controller\Model\Paginator\Paginator;
12-
use OpenSolid\Api\Controller\Model\Paginator\SelectablePaginator;
1311
use OpenSolid\Api\OpenApi\Processor\AugmentOperations;
1412
use OpenSolid\Api\Routing\Attribute\Delete;
1513
use OpenSolid\Api\Routing\Attribute\Get;
1614
use OpenSolid\Api\Routing\Attribute\Post;
1715
use OpenSolid\Api\Routing\Attribute\Put;
1816
use OpenSolid\Core\Domain\Model\GetOrCreateResource;
1917
use OpenSolid\Core\Domain\Repository\InMemoryCollection;
18+
use OpenSolid\Core\Domain\Repository\Paginator;
19+
use OpenSolid\Core\Domain\Repository\SelectablePaginator;
2020
use PHPUnit\Framework\Attributes\Test;
2121
use PHPUnit\Framework\TestCase;
2222
use Symfony\Component\HttpFoundation\JsonResponse;

0 commit comments

Comments
 (0)