You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/controllers.md
+68Lines changed: 68 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,6 +151,74 @@ App\Entity\Book:
151
151
It is mandatory to set the `method`, `path` and `controller` attributes. They allow API Platform to configure the routing path and
152
152
the associated controller respectively.
153
153
154
+
## Using the PlaceholderAction
155
+
156
+
Complex use cases may lead you to create multiple custom operations.
157
+
158
+
In such a case, you will probably create the same amount of custom controllers while you may not need to perform custom logic inside.
159
+
160
+
To avoid that, API Platform provides the `ApiPlatform\Action\PlaceholderAction` which behaves the same when using the [built-in operations](operations.md#operations).
161
+
162
+
You just need to set the `controller` attribute with this class. Here, the previous example updated:
You may want different serialization groups for your custom operations. Just configure the proper `normalizationContext` and/or `denormalizationContext` in your operation:
0 commit comments