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

Allow easier override of the "new" action. #223

Merged
merged 1 commit into from
Apr 14, 2015
Merged

Allow easier override of the "new" action. #223

merged 1 commit into from
Apr 14, 2015

Conversation

Pierstoval
Copy link
Contributor

With this commit, we can easily customize the instanciation of our entities.

I'm proposing this modification because we have a specific case in which we only want to add default contents in a brand new instanciated object, but the content is retrieved via webservice, so I'm doing it in the controller.

Also, this simple workaround allows the users to override the method and create new User entity in the FOSUserBundle by returning a new User object using the
$this->container->get('fos_user.user_manager')->createUser() instruction.

I think this is useful 😃

@javiereguiluz
Copy link
Collaborator

@Pierstoval thanks for this proposal. Indeed it's useful, so I'm going to merge it right away. Moreover, I want to improve the way we override things so this method will be very useful for that. Thanks!

@javiereguiluz javiereguiluz merged commit a937046 into EasyCorp:master Apr 14, 2015
javiereguiluz added a commit that referenced this pull request Apr 14, 2015
This PR was merged into the master branch.

Discussion
----------

Allow easier override of the "new" action.

With this commit, we can easily customize the instanciation of our entities.

I'm proposing this modification because we have a specific case in which we only want to add default contents in a brand new instanciated object, but the content is retrieved via webservice, so I'm doing it in the controller.

Also, this simple workaround allows the users to override the method and create new `User` entity in the FOSUserBundle by returning a new User object using the
`$this->container->get('fos_user.user_manager')->createUser()` instruction.

I think this is useful 😃

Commits
-------

a937046 Added an "instanciateNewEntity" controller method
@Pierstoval
Copy link
Contributor Author

We have a really huge new project at work and I succeeded in convincing my colleagues to use EasyAdmin, so don't worry, I'll certainly have A LOT of new proposals :D

@Pierstoval Pierstoval deleted the patch-1 branch April 14, 2015 13:00
@javiereguiluz
Copy link
Collaborator

Great! As always, I only ask you one thing: if you are gonna propose a big change, please consider opening first an issue to discuss about it instead of spending a lot of time working on a pull request. Thanks.

@Pierstoval
Copy link
Contributor Author

Yep, no problem for that!

For this PR, it was mainly discussed in #22 , and in fact, this workaround is the best possible solution to make everyone happy with the constructor issue :)

@javiereguiluz
Copy link
Collaborator

By the way, there was a very minor typo in the name of the method. It's been fixed in 5a11343

@Pierstoval
Copy link
Contributor Author

Language barrier, thanks for fixing 👍

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