Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
alterphp committed Oct 9, 2018
1 parent 97c6222 commit e670283
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ protected function newAjaxAction()
$this->dispatch(EasyAdminEvents::PRE_NEW);

$entity = $this->executeDynamicMethod('createNew<EntityName>Entity');
$easyadmin = $this->request->attributes->get('easyadmin');
$easyadmin['item'] = $entity;
$easyadmin = array_merge($this->request->attributes->get('easyadmin'), array('item' => $entity));
$this->request->attributes->set('easyadmin', $easyadmin);

$fields = $this->entity['new']['fields'];
Expand All @@ -88,7 +87,7 @@ protected function newAjaxAction()
if (isset($this->entity['templates']['new_ajax'])) {
$templatePath = $this->entity['templates']['new_ajax'];
}

return new JsonResponse(['html' => $this->renderView($templatePath, $parameters)]);
}
}

0 comments on commit e670283

Please sign in to comment.