Custom operation, Parameter "id" not found
See original GitHub issueHello,
I’m trying to add a custom route to my application in order to collect data from two entity. I have an entity “Card” and an entity “ScenarioCard”. I created my custom operation in ScenarioCard like that :
Class ScenarioCard
@package App\ShidoCardBundle\Entity
@ORM\Entity
@ApiResource(itemOperations={
"get",
"group_card_info_card_scenario_info"={
"swagger_context" = {
"summary" = "Retrieve a card object with ScenarioCard info",
"parameters" = {
{
"name" = "scenario_id",
"in" = "path",
"required" = "true",
"type" = "string"
},
{
"name" = "card_id",
"in" = "path",
"required" = "true",
"type" = "string"
}
}
},
"method"="GET",
"path"="/scenario/{scenario_id}/card/{card_id}",
"controller"=RetrieveScenarioCard::class,
}
})
Then I created the following handler (as specified in the documentation)
<?php
namespace App\ShidoCardBundle\Controller;
use App\ShidoCardBundle\Entity\ScenarioCard;
class RetrieveScenarioCard
{
private $retrieveScenarioCardHandler;
public function __construct(RetrieveScenarioCardHandler $retrieveScenarioCardHandler)
{
$this->retrieveScenarioCardHandler = $retrieveScenarioCardHandler;
}
public function __invoke(ScenarioCard $data): ScenarioCard
{
$this->retrieveScenarioCardHandler->handle($data);
return $data;
}
}
My problem here is that Hydra send me back the error “Parameter “id” not found” when I try to request the api endpoint associated with this route. If I understood it correctly, the parameter id is mandatory. If it’s true I don’t understand how I will be able to aggregate datas from those two Entities and send back thoses data.
Are Custom operations even the good way to do what I want to do ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
SET PARAMETER ID is not working for custom parameter id
I need parameter id for Scrap(AFRUD-XMNGA) field in CO11N transaction. But the scrap field do not have the parameter id. So I created...
Read more >Custom operation IDs for single document, and not the other
Step 1: Set operation ids Actions have no operation ids by default, so use SwaggerGenOptions. CustomOperationIds() to populate the values.
Read more >Mysterious error in custom connector appearing aft...
I went to go in an add another action to a custom connector I have. This would the 11th one. I've been using...
Read more >Question: Custom connector: parameter in the operation
I'm developing a custom connector and was wondering if there's a way to expose parameters that can be accepted for a specific operation....
Read more >On a custom object I get this error on Conga Composer button
when I click the button on the parts list view, I get the error that the id parameter is missing. What am I...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think you’ll need to fetch the data by yourself with a dataProvider, and you’ll need to add
_api_receiveat false for this operation. otherwise it’ll try to get it automatically.Closing this, hope that we were helpful.