sonata-project/SonataAdminBundle — pull request #1999 by matteo78 (2014-03-14 11:26:12+00:00)
Title: addNewInstance does not guess correctly the add method's name

I encountered a bug while using the `sonata_type_collection` form type. Clicking on the "Add" button would not do anything. After inspecting a bit, I noticed that the route `sonata_admin_append_form_element` was generating a 500 error.

I was working with a _Post_ entity linked to a _Category_ one. An exception was thrown on this action saying that I had to add a method `addCategorie` in the Post entity. Instead, I had an `addCategory`, generated by Doctrine.

I found this bug was located in the _AdminHelper_ class which was guessing the add... method's name incorrectly, simply by trimming the latest 's' in the field's name. In this pull request, I replaced it by using the entity's classname which is by convention in a singular form.