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..
About
About https://github.com/spryker/company-role/blob/1.7.1/src/Spryker/Zed/CompanyRole/Persistence/Mapper/CompanyRoleCompanyUserMapper.php We have companies with many users. https://blackfire.io/profiles/d30d8669-c9fe-4e77-95d8-259f2b1dfc7a/graph As you can see in this case the hydration is called 48 times and we had around 100 test users. This resulted in three 2 x 4944 calls to fromArray()
and toArray()
as this transferObject ins converted. And 4944 other things that didn't have so much impact. And after that the whole data is loaded in the session and bloats the session beyond reasonable usage. So we decided to just do not load this Collection inside of Zed\CompanyRole\Persistence\CompanyRoleRepository::prepareCompanyRoleTransfer
. We did this by inheritance which leaves a bad feeling if there are changes in any later version of spryker. By composition is not an option. Or we could rewrite a lot code paths in the system. So just load the User Collection on demand seemed to be the best option. Any ideas how this could be solved better? My best guess is that the core behaviour should be changed here. But maybe there is even a better solution we didn't guess?
Comments
-
Hi Karsten, I believe we have some improvements requests from the related area already but still it would help if you could create a support request so we could forward it to our development team for fixing if it's not the same or push them if such a request already exists.
0 -
We had the same problem... already pushed to spryker... (July 2020).
We have with Spryker Dev last year investigated and we found out that the has no sense the company user hydration there..
We have too overrided it on pyz level so:
/** * @param \Orm\Zed\CompanyRole\Persistence\SpyCompanyRole $spyCompanyRole * * @return \Generated\Shared\Transfer\CompanyRoleTransfer */ protected function prepareCompanyRoleTransfer(SpyCompanyRole $spyCompanyRole): CompanyRoleTransfer { $companyRoleTransfer = $this->getFactory() ->createCompanyRoleMapper() ->mapEntityToCompanyRoleTransfer( $spyCompanyRole, new CompanyRoleTransfer() ); $companyRoleTransfer = $this->getFactory() ->createCompanyRolePermissionMapper() ->hydratePermissionCollection( $spyCompanyRole, $companyRoleTransfer ); $companyRoleTransfer = $this->getFactory() ->createCompanyRoleCompanyMapper() ->mapCompanyFromCompanyRoleEntityToCompanyRoleTransfer( $spyCompanyRole, $companyRoleTransfer ); return $companyRoleTransfer; }
And everything works fine.
0 -
Thanks @UL65CH0MC for sharing - that's somehow what we are doing as well.
0 -
@valerii.trots i used your form and created a case
0 -
We've got it, thanks! 🙂
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