-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Background:
I'm going to give an example of my current scenario to better explain the issue I'm facing.
This is my query:
final class FetchBla extndes Query {
/**
* @Serializer\Type("uuid")
*
* @Assert\Type(UuidInterface::class)
*
* @var UuidInterface
*/
private $id;
// other stuff
}
As you can see I'm relying on JMS to perform the array tranformation from the Input
to my query object. The property I'm expecting is called id
.
This is my command:
final class CreateBla
{
/**
* @Serializer\Type("uuid")
* @Serializer\SerializedName(IdGenerator::GENERATED_ID)
*
* @Assert\Type(UuidInterface::class)
* @Assert\NotBlank()
*
* @var UuidInterface
*/
private $id;
As you can see, I'm relying on top of chimera's Id generation strategy to generate the resource id, the problem is that when I'm trying to wire this 2 components together in the handler:
/**
* @Chimera\ServiceBus\CommandHandler(handles=CreateForm::class)
* @Chimera\Routing\CreateAndFetchEndpoint(
* path="/forms",
* command=CreateForm::class,
* name="CreateForm",
* redirectTo="GetForm",
* query=GetForm::class
* )
*/
When I execute the createAndFetch
, then the value for the id
filed assigned to the query is null
and that's because of the mismatch between the @Serializer\SerializedName(IdGenerator::GENERATED_ID)
of the command and the simple id
in the Query
.
I'm unsure how to proceed on this, wether I'm missing something or wether this is a limitation of Chimera.
Ideally I don't want to change my Query or create any other pre-deserialize hook to handle this scenario.
Thanks in advance.