Is there any way to determine current action (create or edit) in Sonata\AdminBundle\Admin\Admin::configureFormFields()?
You can also do this:
protected function configureFormFields(FormMapper $formMapper) { if ($this->isCurrentRoute('create')) { // CREATE } else { // EDIT }}
with:
if($this->getRequest()->get($this->getIdParameter()) == null){ // create} else { // edit}
I use this :
$creationMode = ($this->id($this->getSubject()))?(false):(true);if ($creationMode){ //Ok}