-
-
Notifications
You must be signed in to change notification settings - Fork 978
Closed
Labels
Description
I am having issues with my item operations for my endpoints. I am assuming it's not picking up the {id} in the path.
resources.yaml
App\Entity\Agent:
collectionOperations:
post:
method: 'POST'
path: '/agent'
validation_groups: ['Default','postValidation']
controller: 'App\Controller\CreateAgent'
itemOperations:
put:
method: 'PUT'
path: '/agent/{id}/update'
validation_groups: ['Default']
controller: 'App\Controller\UpdateAgent'
get:
method: 'GET'
path: '/agent/{id}/client-information'
controller: 'App\Controller\GetClientInformation'
normalization_context:
groups: ['clientInformationResults']
controller for one of the endpoints:
namespace App\Controller;
use App\Entity\Agent;
class GetClientInformation
{
/**
* @param Agent $data
* @return Agent
*/
public function __invoke(Agent $data): Agent
{
return $data;
}
}
Error
@context": "/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Not Found",
"trace": [
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "/app/vendor/api-platform/core/src/EventListener/ReadListener.php",
"line": 107,
"args": []
},
...........
I am assuming I am missing something in my configs but I can't find any examples of this.