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 Please let me know when we should use reader and writer classes as per spryker standards.
Hi
Please let me know when we should use reader and writer classes as per spryker standards.
Comments
-
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βοΈ - Guardians (admin)
Hey, can you maybe elaborate more on what exactly you need to know?
0 -
In Some vendor modules, reader and writer classes are written when we are fetching data and saving data.
So I just need to know if there is formatting required while saving or fetching then whether we should use reader or writer classes.
or is there any further use cases for these classes.0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βοΈ - Guardians (admin)
It is mostly about separating different logic
0 -
Can you please provide some usecase for that with examples
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βοΈ - Guardians (admin)
Ideally you should follow some kind of the following structure:
/Business /EntityA /Writer EntityAWriterInterface EntityAWriter /Reader EntityAReaderInterface EntityAReader /Expander EntityAExpanderInterface EntityAExpander /EntityB /Writer /Reader /Expander
Reader: reads and optionally hydrates the corresponding entity or entities
Writer: saves and/or creates and/or deletes the corresponding entity or entities
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βοΈ - Guardians (admin)
Does this help?
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βοΈ - Guardians (admin)
But please have in mind that you dont need these interfaces on project level in most of the cases
0 -
ok, it means if while saving and fetching any business logic is there then reader and writer comes into picture.
Ok thanks for clearing out the confusion.0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βοΈ - Guardians (admin)
Yeah, it is in the end just a logical separation between read & write, similar to Repository and Entitymanager
0 -
so before entering to repository , reader is there and and before entering to entity manager , writer is there for any business logic, Please confirm.
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βοΈ - Guardians (admin)
reader and writer are both there for business logic (since they are in the business layer) - If you would just forward the EntityManager or Repository inside the reader and writer you can also use the EntityManager or Repository directly in the Facade. But as soon as you need to do additional operations you should introduce a reader and/or a writer class to put the logic there.
0 -
ok thanks
0 -
it helpsπ
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