How to save a custom entity with child entities related?Magento 2 - Best practice to get current dateGood practice regarding core tables relations with modules tablesShould I use dynamic variables in cache tags?Product brand (attribute, category or both)?Reference for Magento2 best practicesMagento 2 Save custom entity primary keyBest Way to Load a Custom Model in Magento 2When Should We Use a Repository and Factory in Magento 2?Good practice: how to save many objects?ECG compliance: How to do?
Why is delta-v is the most useful quantity for planning space travel?
Efficiently merge handle parallel feature branches in SFDX
The plural of 'stomach"
Is expanding the research of a group into machine learning as a PhD student risky?
Why does John Bercow say “unlock” after reading out the results of a vote?
The baby cries all morning
What's a natural way to say that someone works somewhere (for a job)?
Using parameter substitution on a Bash array
Why did Kant, Hegel, and Adorno leave some words and phrases in the Greek alphabet?
How do I rename a LINUX host without needing to reboot for the rename to take effect?
Is there a good way to store credentials outside of a password manager?
Why "be dealt cards" rather than "be dealing cards"?
There is only s̶i̶x̶t̶y one place he can be
Is it okay / does it make sense for another player to join a running game of Munchkin?
Failed to fetch jessie backports repository
Can somebody explain Brexit in a few child-proof sentences?
Is there any easy technique written in Bhagavad GITA to control lust?
What is difference between behavior and behaviour
Teaching indefinite integrals that require special-casing
What will be the benefits of Brexit?
What to do with wrong results in talks?
How was Earth single-handedly capable of creating 3 of the 4 gods of chaos?
Can a monster with multiattack use this ability if they are missing a limb?
What would be the benefits of having both a state and local currencies?
How to save a custom entity with child entities related?
Magento 2 - Best practice to get current dateGood practice regarding core tables relations with modules tablesShould I use dynamic variables in cache tags?Product brand (attribute, category or both)?Reference for Magento2 best practicesMagento 2 Save custom entity primary keyBest Way to Load a Custom Model in Magento 2When Should We Use a Repository and Factory in Magento 2?Good practice: how to save many objects?ECG compliance: How to do?
I have a question about saving a custom entity with some child entities related.
In Magento 1, I used to set a child items collection inside the main entity model and after saving it, in '_afterSave()' method, check if any child entity had been defined and, if yes, save each child entity individually.
In your opinion, what is the best practice for doing it in Magento 2?
- Follow the Magento 1 approach?
- Use 'relationProcessors' of Magento 2?
- Other solution?
magento2 best-practice
add a comment |
I have a question about saving a custom entity with some child entities related.
In Magento 1, I used to set a child items collection inside the main entity model and after saving it, in '_afterSave()' method, check if any child entity had been defined and, if yes, save each child entity individually.
In your opinion, what is the best practice for doing it in Magento 2?
- Follow the Magento 1 approach?
- Use 'relationProcessors' of Magento 2?
- Other solution?
magento2 best-practice
add a comment |
I have a question about saving a custom entity with some child entities related.
In Magento 1, I used to set a child items collection inside the main entity model and after saving it, in '_afterSave()' method, check if any child entity had been defined and, if yes, save each child entity individually.
In your opinion, what is the best practice for doing it in Magento 2?
- Follow the Magento 1 approach?
- Use 'relationProcessors' of Magento 2?
- Other solution?
magento2 best-practice
I have a question about saving a custom entity with some child entities related.
In Magento 1, I used to set a child items collection inside the main entity model and after saving it, in '_afterSave()' method, check if any child entity had been defined and, if yes, save each child entity individually.
In your opinion, what is the best practice for doing it in Magento 2?
- Follow the Magento 1 approach?
- Use 'relationProcessors' of Magento 2?
- Other solution?
magento2 best-practice
magento2 best-practice
asked yesterday
bruno.gemellibruno.gemelli
112
112
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267291%2fhow-to-save-a-custom-entity-with-child-entities-related%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267291%2fhow-to-save-a-custom-entity-with-child-entities-related%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown