Skip to content

[make:crud] use save instead of add repository methods #1204

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

Merged
merged 2 commits into from
Sep 22, 2022

Conversation

jrushlow
Copy link
Collaborator

@jrushlow jrushlow commented Sep 22, 2022

Instead of using an add() method in the repository, it's been renamed to save(). Logic behind the change is to not confuse with "add()" and item to a collection - we're "save()"ing an entity to persistence.

Original work done by @bdaler in #1169
fixes #1138
fixes #788

@jrushlow jrushlow changed the title use add instead of save [make:crud] use add instead of save repository methods Sep 22, 2022
@jrushlow jrushlow changed the title [make:crud] use add instead of save repository methods [make:crud] use save instead of add repository methods Sep 22, 2022
@jrushlow jrushlow added Related Tests Pass Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels Sep 22, 2022
Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

ok with me 👍

@jrushlow jrushlow added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Sep 22, 2022
@jrushlow jrushlow merged commit ea972b4 into symfony:main Sep 22, 2022
@jrushlow jrushlow deleted the fix/1169 branch September 22, 2022 12:56
weaverryan added a commit that referenced this pull request Jul 10, 2023
…ories (mdoutreluingne, weaverryan)

This PR was merged into the 1.0-dev branch.

Discussion
----------

[WCM] Deleting `save` and `remove` methods from repositories

Fix #1327

In this PR I've removed the `save` and `remove` methods from the repositories, for the reasons explained here #1327.

( The add method has been renamed to save, here #1204 )

Reviews welcome!

Commits
-------

6d4c62c Removed unecessary use statement
dff2f97 Fixing look up of Symfony version + removing incorrect renderForm() on 2x assertion methods
c3b506d Fix use statement sort
027b9f5 Add WithCustomRepositoryLegacy.php to include the `renderForm()` version
1650332 Replacement renderForm() method deprecated by render() method
e919b78 Adding EntityManagerInterface use statement if not already added
bbb7967 Adding EntityManagerInterface use statement
5038082 Deleting `add` and `remove` methods from repositories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New Feature Related Tests Pass Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repository template - rename add method to save Improve controller generation in make:crud command
3 participants