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..
Hi, I got the following error: *Spryker\Shared\ZedRequest\Client\Exception\TransferNotFoundExceptio
Hi, I got the following error:
Spryker\Shared\ZedRequest\Client\Exception\TransferNotFoundException - No class name given for Transfer generation.
I actually know what this error is about (returning a proper transfer). In my usecase I am returning an array of MerchantRelationshipTransfer
. Do I need to create aMerchantRelationshipCollectionTransfer()
(CollectionTransfer doesn't exist yet) or is it possible to solve it "easier"?
Comments
-
Probably just remove the *Transfer suffix from your property. The declaration should be without just the ClassName
0 -
Not sure if I got you right. This here is my current code
/** * @param \Generated\Shared\Transfer\CompanyBusinessUnitTransfer $companyBusinessUnit * @return \Generated\Shared\Transfer\MerchantRelationshipTransfer[] */ public function getMerchantRelationshipCollectionByOwnerCompanyBusinessUnitAction(CompanyBusinessUnitTransfer $companyBusinessUnit) { $facade = new MerchantRelationshipFacade(); $allMR = $facade->getMerchantRelationshipCollection(); $currentMR = []; foreach($allMR as $merchantRelation) { if($merchantRelation->getOwnerCompanyBusinessUnit()->getIdCompanyBusinessUnit() == $companyBusinessUnit->getIdCompanyBusinessUnit()) { $currentMR[] = $merchantRelation; } } return $currentMR; }
0 -
Ok you can return an array of Transfers. Thats not a problem. It looks more like you dont have the
MerchantRelationshipTransfer
in first place. Does it exist?0 -
Side note, don't instantiate business objects in your code, pass them as dependencies. So the
MerchantRelationshipFacade
should be a dependency0 -
It looks more like you dont have the
MerchantRelationshipTransfer
in first place. Does it exist?Β (edited)the
$allMR
contains several Objects of type MerchantRelationshipTransfer0 -
Ah let me guess, you trying it from a gatewayController right?
0 -
so for a client/Stub call. Then you need a proper wrapper transfer yes.
0 -
Ah, alright π there we go, sorry if I wasn't clear enough at the beginning.
0 -
Side note, don't instantiate business objects in your code, pass them as dependencies. So the
MerchantRelationshipFacade
should be a dependencyThanks for the hint, this was just a first try. I'll move this code anyway. Currently this is nested in the GatewayController from product-list. I'll move this specific function to merchant-relation. There I can access the facade directly.
0 -
no worries, the easiest is to just wrap this in *ResponseTransfer where you also set the status
0 -
ok π
0 -
Side note, donβt instantiate business objects in your code, pass them as dependencies. So the
MerchantRelationshipFacade
should be a dependencyso in case of a GatewayController it must not be a dependency, it should be resolved by $this->getFacade() to the right (current moduleβs) facade π
0 -
Moved everything nice and clean into merchant-relation bundle today.
Getting back to this topic: how do I wrap an entity into a responseTransfer?
My first thought on this would be to define a new transferObject likeproject/src/Pyz/Shared/MerchantRelation/Transfer/merchant_relationship_collection.transfer.xml
π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