What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
can you return `void` from a GatewayController ? or rather, do we have to create a transfer object e
Comments
-
Had this issue as well. To make it short - you ALWAYS need a transfer. If you dont have any properties to pass, just pass an empty object. That should do the job.
0 -
that depends on ZedRequestClient
0 -
by default it returns Transfer object from last response
0 -
an empty transfer you mean?
0 -
@UKGT7RC7P Yes.
0 -
\Spryker\Shared\ZedRequest\Client\AbstractHttpClient::getTransferFromResponse()
0 -
$data = json_decode(trim($response->getBody()), true); if (!$data || !is_array($data)) { throw new InvalidZedResponseException('Invalid JSON', $response, $request->getUri()); }
0 -
hm, so you could override the ZedRequestClient
0 -
you have to if you really need to return void from gateway controller
0 -
@UKGT7RC7P Never came to this idea, but Ievgen knows for sure better.
0 -
well, often i'd like to pass / return non-transfer objects
0 -
(especially passing)
0 -
seems I often do
BlahRequestTransfer
andBlahResponseTransfer
0 -
@UKGT7RC7P Passing non-transfer objects (i.e. arrays etc) between app layers breaks the Spryker conventions afaik.
0 -
of course π
0 -
the problem is you end up creating a transfer object per request if they have different args
0 -
or, worse, you use the same transfer object for all of them and have no API at all
0 -
would be so much nicer to just pass arguments
0 -
I agree, it somehow hurts. But, on the other hand, you are welcome to create unlimited amount of TOs π
0 -
π
0 -
Creating a transfer is a very small overhead, it would be possible to remove this requirement but it takes a lot of overriding on the project level. In my opinion it is just not worth it.
0 -
And by convention you should be sending and receiving a business object ... just saying
0 -
I know that's the convention, but the "business" objects are transfer objects where everything is nullable
0 -
you can always return true if action is successful
0 -
can you? π€
0 -
wrapped in a transfer of course
0 -
BooleanTransfer.php
0 -
I usually make a {ActionName}ResponseTransfer
0 -
and then if I need to actually return something I can add stuff
0 -
and I have property isSuccess in it
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random