Reputation: 2018
How do I get rid of messages like this?
[2019-10-28 18:18:55] php.INFO: User Deprecated: Not setting the "method" attribute is deprecated and will not be supported anymore in API Platform 3.0, set it for the item operation "api_admin_azvr_users_get_item" of the class "App\API\DTO\AdminAzvrUser". {"exception":"[object] (ErrorException(code: 0): User Deprecated: Not setting the \"method\" attribute is deprecated and will not be supported anymore in API Platform 3.0, set it for the item operation \"api_admin_azvr_users_get_item\" of the class \"App\API\DTO\AdminAzvrUser\". at /home/avrsites/websites/mydomain.com/symfony/vendor/api-platform/core/src/Bridge/Symfony/Routing/ApiLoader.php:206)"} []
Here are the annotations of the referenced DTO class:
* @ApiResource(
* itemOperations={
* "get"={
* "path"="/admin_azvr_user/{id}",
* },
* "api_admin_azvr_users_get_item"={
* "swagger_context"={
* "operationId"="getAdminAzvrUserItem",
* "summary"="Retrieves details on a user (msg_azvr_user table)",
* "parameters"= {
* {
* "name"="id",
* "description"="Inquiry ID",
* "default"="520",
* "in"="path",
* "required"=true,
* "type"="string"
* }
* },
* "responses"={
* "200"={
* "description"="Results retrieved"
* },
* "400"={
* "description"="Invalid input"
* },
* "404"={
* "description"="User not found"
* }
* }
* }
* }
* },
* collectionOperations={}
* )
Where am I supposed to set the "method" attribute? I tried setting "method"="GET"
inside the api_admin_azvr_users_get_item
section, but it did not fix the problem.
My log is full of these messages and I can't find any relevant documentation on how to fix things.
Upvotes: 0
Views: 522
Reputation: 1709
It needs to be placed on the mentioned item operation, in this case: api_admin_azvr_users_get_item
which results in:
* @ApiResource(
* itemOperations={
* "api_admin_azvr_users_get_item"={
* "method"="GET",
* "path"="/admin_azvr_user/{id}",
* "swagger_context"={
* "operationId"="getAdminAzvrUserItem",
* "summary"="Retrieves details on a user (msg_azvr_user table)",
* "parameters"= {
* {
* "name"="id",
* "description"="Inquiry ID",
* "default"="520",
* "in"="path",
* "required"=true,
* "type"="string"
* }
* },
* "responses"={
* "200"={
* "description"="Results retrieved"
* },
* "400"={
* "description"="Invalid input"
* },
* "404"={
* "description"="User not found"
* }
* }
* }
* }
* },
* collectionOperations={}
* )
If the deprecation note remains try clearing the cache bin/console cache:clear
Upvotes: 0