Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Model::withPersistence #676

Merged
merged 2 commits into from
Jul 26, 2020

Conversation

georgehristov
Copy link
Collaborator

No description provided.


return $m;
$model->data = $this->data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method duplicates some other code.

Why is copying data prop better than ->set($model->get()) (some mention in the title?)

The code before it is a duplicate of asModel(), right?

Copy link
Collaborator Author

@georgehristov georgehristov Jul 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. asModel and newInstance use the same persistence.

Why is copying data prop better than ->set($model->get()) (some mention in the title?)

I will remove this from the code comments as data is copied from the source model already.
What you expect from this method is a model clone with different persistence.

Copy link
Member

@mvorisek mvorisek Jul 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do your bests and lets merge this


return $m;
$model->data = $this->data;
Copy link
Member

@mvorisek mvorisek Jul 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do your bests and lets merge this

@georgehristov georgehristov merged commit ef60d01 into develop Jul 26, 2020
@georgehristov georgehristov deleted the feature/improve-with-persistence branch July 26, 2020 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants