Skip to content

Commit 19350b4

Browse files
Deuchnorddunglas
authored andcommitted
Custom operation: enhancing the visibility of an important remark (#589)
* Custom operation: enhancing the visibility of an important remark The information about necessity that the `__invoke()` method’s parameter must be called was easy to miss in the large amount of information. This proposal makes it more visible by putting it in its own paragraph and by writing it in bold. * Update operations.md
1 parent 590f5c7 commit 19350b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/operations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ This action will be automatically registered as a service (the service name is t
561561

562562
API Platform automatically retrieves the appropriate PHP entity using the data provider then deserializes user data in it,
563563
and for `POST` and `PUT` requests updates the entity with data provided by the user.
564-
By convention, the action's parameter must be called `$data`.
564+
565+
**Warning: the `__invoke()` method parameter [MUST be called `$data`](https://symfony.com/doc/current/routing/extra_information.html)**, otherwise, it will not be filled correctly!
565566

566567
Services (`$myService` here) are automatically injected thanks to the autowiring feature. You can type-hint any service
567568
you need and it will be autowired too.

0 commit comments

Comments
 (0)