Skip to content

Commit

Permalink
refactor(ext): move doctrine extensions from core to symfony
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceAmstoutz committed Nov 28, 2024
1 parent 8115686 commit ee2946f
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/doctrine-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ Done: Doctrine will automatically filter all `UserAware`entities!

Doctrine ORM filters have access to the context created from the HTTP request and to the `QueryBuilder` instance used to
retrieve data from the database. They are only applied to collections. If you want to deal with the DQL query generated
to retrieve items, [extensions](extensions.md) are the way to go.
to retrieve items, [extensions](../symfony/extensions.md) are the way to go.

A Doctrine ORM filter is basically a class implementing the `ApiPlatform\Doctrine\Orm\Filter\FilterInterface`.
API Platform includes a convenient abstract class implementing this interface and providing utility methods: `ApiPlatform\Doctrine\Orm\Filter\AbstractFilter`.
Expand Down Expand Up @@ -1347,7 +1347,7 @@ class Offer

Doctrine MongoDB ODM filters have access to the context created from the HTTP request and to the [aggregation builder](https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/current/reference/aggregation-builder.html)
instance used to retrieve data from the database and to execute [complex operations on data](https://docs.mongodb.com/manual/aggregation/).
They are only applied to collections. If you want to deal with the aggregation pipeline generated to retrieve items, [extensions](extensions.md) are the way to go.
They are only applied to collections. If you want to deal with the aggregation pipeline generated to retrieve items, [extensions](../symfony/extensions.md) are the way to go.

A Doctrine MongoDB ODM filter is basically a class implementing the `ApiPlatform\Doctrine\Odm\Filter\FilterInterface`.
API Platform includes a convenient abstract class implementing this interface and providing utility methods: `ApiPlatform\Doctrine\Odm\Filter\AbstractFilter`.
2 changes: 1 addition & 1 deletion core/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,4 @@ See how to use Elasticsearch filters and how to create Elasticsearch custom filt

## Creating Custom Extensions

See how to create Elasticsearch custom extensions in [the Extensions chapter](extensions.md).
See how to create Elasticsearch custom extensions in [the Extensions chapter](../symfony/extensions.md).
2 changes: 1 addition & 1 deletion core/extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following tables summarizes which extension point to use depending on what y

| Extension Point | Usage |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [Extensions](extensions.md) | Access to the query builder to change the DQL query |
| [Extensions](../symfony/extensions.md) | Access to the query builder to change the DQL query |
| [Filters](filters.md#doctrine-orm-and-mongodb-odm-filters) | Add filters documentations (OpenAPI, GraphQL, Hydra) and automatically apply them to the DQL query |

## Leveraging the Built-in Infrastructure Using Composition
Expand Down
2 changes: 1 addition & 1 deletion core/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ See how to use them and how to create custom ones in the [filters documentation]

## Creating Custom Extensions

See how to create Doctrine MongoDB ODM custom extensions in the [extensions documentation](extensions.md).
See how to create Doctrine MongoDB ODM custom extensions in the [extensions documentation](../symfony/extensions.md).

## Adding Execute Options

Expand Down
2 changes: 1 addition & 1 deletion core/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Fortunately, Doctrine offers another approach to solve this problem: [eager load
This can easily be enabled for a relation: `#[ORM\ManyToOne(fetch: "EAGER")]`.

By default in API Platform, we chose to force eager loading for all relations, with or without the Doctrine
`fetch` attribute. Thanks to the eager loading [extension](extensions.md). The `EagerLoadingExtension` will join every
`fetch` attribute. Thanks to the eager loading [extension](../symfony/extensions.md). The `EagerLoadingExtension` will join every
readable association according to the serialization context. If you want to fetch an association that is not serializable,
you have to bypass `readable` and `readableLink` by using the `fetchEager` attribute on the property declaration, for example:

Expand Down
2 changes: 1 addition & 1 deletion outline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ chapters:
- testing
- debugging
- caddy
- extensions
- title: "API Platform for Laravel"
path: laravel
items:
Expand Down Expand Up @@ -42,7 +43,6 @@ chapters:
- deprecations
- default-order
- performance
- extensions
- messenger
- dto
- openapi
Expand Down
2 changes: 1 addition & 1 deletion symfony/debugging.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Debugging
# Debugging with Symfony

<p align="center" class="symfonycasts"><a href="https://symfonycasts.com/screencast/api-platform/profiler?cid=apip"><img src="images/symfonycasts-player.png" alt="API Platform debugging screencast"><br>Watch the Debugging API Platform screencast</a></p>

Expand Down
4 changes: 2 additions & 2 deletions core/extensions.md → symfony/extensions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Extensions
# Extensions with Symfony

API Platform provides a system to extend queries on items and collections.

Expand All @@ -12,7 +12,7 @@ You can find a working example of a custom extension in the [API Platform's demo

Custom extensions must implement the `ApiPlatform\Doctrine\Orm\Extension\QueryCollectionExtensionInterface` and / or the `ApiPlatform\Doctrine\Orm\Extension\QueryItemExtensionInterface` interfaces, to be run when querying for a collection of items and when querying for an item respectively.

If you use [custom state providers](state-providers.md), they must support extensions and be aware of active extensions to work properly.
If you use [custom state providers](../core/state-providers.md), they must support extensions and be aware of active extensions to work properly.

### Example

Expand Down

0 comments on commit ee2946f

Please sign in to comment.