{"id":18031623,"url":"https://gitlab.com/ludo444/aggregationbuilderpaginationbundle","last_synced_at":"2025-03-27T05:30:50.093Z","repository":{"id":61691801,"uuid":"17862378","full_name":"ludo444/aggregationbuilderpaginationbundle","owner":"ludo444","description":"Paginate Doctrine MongoDB ODM AggregationBuilder with KnpPaginatorBundle","archived":false,"fork":false,"pushed_at":null,"size":null,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":null,"default_branch":"master","last_synced_at":"2025-03-23T04:24:09.953Z","etag":null,"topics":["aggregation","bundle","mongodb","pager","pagination","paginator","symfony"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":null,"metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-01T16:24:30.805Z","updated_at":"2020-10-22T18:57:10.510Z","dependencies_parsed_at":"2022-10-20T12:30:35.386Z","dependency_job_id":null,"html_url":"https://gitlab.com/ludo444/aggregationbuilderpaginationbundle","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/ludo444%2Faggregationbuilderpaginationbundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/ludo444%2Faggregationbuilderpaginationbundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/ludo444%2Faggregationbuilderpaginationbundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/ludo444%2Faggregationbuilderpaginationbundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners/ludo444","download_url":"https://gitlab.com/ludo444/aggregationbuilderpaginationbundle/-/archive/master/aggregationbuilderpaginationbundle-master.zip","host":{"name":"gitlab.com","url":"https://gitlab.com","kind":"gitlab","repositories_count":4518292,"owners_count":6896,"icon_url":"https://github.com/gitlab.png","version":null,"created_at":"2022-05-30T11:31:42.605Z","updated_at":"2024-07-18T11:24:13.055Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners"}},"keywords":["aggregation","bundle","mongodb","pager","pagination","paginator","symfony"],"created_at":"2024-10-30T10:09:58.476Z","updated_at":"2025-03-27T05:30:49.467Z","avatar_url":null,"language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# LudoAggregationBuilderPaginationBundle\n\n![pipeline_status][pipeline]\n\nExtension bundle for Symfony's [KnpPaginatorBundle][KnpPaginatorBundle] that allows to paginate\n[DoctrineMongoDBBundle][DoctrineMongoDBBundle] [`Doctrine\\ODM\\MongoDB\\Aggregation\\Builder`][AggregationBuilder].\n\n## Requirements\n\nBundle uses MongoDB [`$facet`][facet] operator which is available since MongoDB 3.4.\n\n## Installation with Symfony Flex\n\nOpen a command console, enter your project directory and execute:\n\n```console\n$ composer require ludo444/aggregation-builder-pagination-bundle\n```\n\n## Installation without Symfony Flex\n\n### Step 1: Download the Bundle\n\nOpen a command console, enter your project directory and execute the\nfollowing command to download the latest stable version of this bundle:\n\n```console\n$ composer require ludo444/aggregation-builder-pagination-bundle\n```\n\n### Step 2: Enable the Bundle\n\nThen, enable the bundle by adding it to the list of registered bundles\nin the `config/bundles.php` file of your project:\n\n```php\n// config/bundles.php\n\nreturn [\n    // ...\n    Ludo\\Bundle\\AggregationBuilderPaginationBundle\\LudoAggregationBuilderPaginationBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n## Usage\n\n[`Doctrine\\ODM\\MongoDB\\Aggregation\\Builder`][AggregationBuilder] needs to be passed into `paginate()` method. Be aware that\nmost of the `Builder` methods are returning `Doctrine\\ODM\\MongoDB\\Aggregation\\Stage`. So you need to do eg.:\n\n```php\n// src/Repository/ExampleRepository.php\nuse Doctrine\\ODM\\MongoDB\\Aggregation\\Builder as AggregationBuilder;\n// ...\n\nclass ExampleRepository extends Repository\n{\n    public function getExamples(): AggregationBuilder\n    {\n        $ab = $this-\u003ecreateAggregationBuilder();\n        \n        $ab-\u003ehydrate(Example::class)\n            -\u003ematch()\n                -\u003efield('field')\n                -\u003eequals('value');\n        \n        return $ab;\n    }\n}\n```\n\nAs `-\u003eequals('value')` would not return `AggregationBuilder`, the code would throw an `Exception` if you return\nthe result of that method directly. Now to paginate the example repository method, you can just do:\n\n```php\n// src/Subfolder/ExamplePagination.php\n// ...\n\nclass ExamplePagination\n{\n    // ...\n\n    public function __construct(DocumentManager $manager, PaginatorInterface $paginator)\n    {\n        $this-\u003emanager = $manager;\n        $this-\u003epaginator = $paginator;\n    }\n\n    public function getPaginatedExamples(): PaginationInterface\n    {\n        return $this-\u003epaginator-\u003epaginate(\n            $this-\u003emanager-\u003egetRepository(ExampleRepository::class)-\u003egetExamples()\n        );\n    }\n}\n```\n\n[pipeline]: https://gitlab.com/ludo444/aggregationbuilderpaginationbundle/badges/master/pipeline.svg\n[KnpPaginatorBundle]: https://github.com/KnpLabs/KnpPaginatorBundle\n[DoctrineMongoDBBundle]: https://github.com/doctrine/DoctrineMongoDBBundle\n[facet]: https://docs.mongodb.com/manual/reference/operator/aggregation/facet/\n[AggregationBuilder]: https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/2.0/reference/aggregation-builder.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/gitlab.com%2Fludo444%2Faggregationbuilderpaginationbundle","html_url":"https://awesome.ecosyste.ms/projects/gitlab.com%2Fludo444%2Faggregationbuilderpaginationbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/gitlab.com%2Fludo444%2Faggregationbuilderpaginationbundle/lists"}