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鈥檒l 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

Conversation

@Pierstoval
Copy link
Contributor

Pierstoval commented Apr 14, 2015

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

javiereguiluz commented Apr 14, 2015

@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
2 checks passed
2 checks passed
Scrutinizer 1 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
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

Pierstoval commented Apr 14, 2015

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 Pierstoval:patch-1 branch Apr 14, 2015
@javiereguiluz
Copy link
Collaborator

javiereguiluz commented Apr 14, 2015

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

Pierstoval commented Apr 14, 2015

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

javiereguiluz commented Apr 14, 2015

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

Pierstoval commented Apr 14, 2015

Language barrier, thanks for fixing 馃憤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can鈥檛 perform that action at this time.