Closed DennisdeBest closed 3 years ago
When decorating a service you need to copy over the tags of the service you are decorating. Those are not getting copied. So while the Sylius Handler was tagged as a messenger.message_handler
the new service needs to be tagged as well. That looks like the only thing you are missing.
Thanks a lot for your reply, I will try it out and let you know !
Ok I got it working. After setting up all the services I still had the error. This was because of my
use Sylius\ShopApiPlugin\Command\Customer\RegisterCustomer;
class UserRegistrationCommand extends RegisterCustomer
and the ChannelBasedCommandProvider
would call
$this->requestClass::fromHttpRequestAndChannel($httpRequest, $channel);
And I did not override this function in my child class :
public static function fromHttpRequestAndChannel(Request $request, ChannelInterface $channel): ChannelBasedRequestInterface
{
return new self($request, $channel->getCode());
}
So it would return the parent class instead and there is no more handler for that class.
Thanks !
Hello, I am setting up a Sylius 1.8.6 with the Shop API plugin
What needs to be done is adding some fields on the user registration. I have managed to add them to the Sylius ShopUser entity by adding to the class
namespace App\Entity\User\ShopUser
And to the fixtures by creating a
ShopUserFactory
and a
ShopUserFixture
And adding the two to my
services.yaml
Now what I want to do is make sure this is added when the api is called on
/register
I have been following the documentation and created a customRequest
,Handler
andCommand
And I have also added these to my
services.yaml
As the documentation says about overriding handlers
I thought this bit :
would make the request go through my class instead of the default however I keep getting the error :
And while using xdebug or even adding some
dd()
's inside any of those three classes the code never goes through them.Am I not registering the new service correctly ? I can't find anything regarding this.
Thanks for any one pointing me in the right direction.
EDIT
I was overiding the wronk class, but when I override
namespace Sylius\ShopApiPlugin\Handler\Customer\RegisterCustomerHandler
I get the following error about messenger :And I still have no clue on how to fix this ...