Skip to content

Commit

Permalink
bug #2379 Fixed the order of update events in AJAX edits (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

Fixed the order of update events in AJAX edits

As explained in #2296, the order of events is not exactly the same when editing an entity using a normal form or via an Ajax event. So let's tweak slightly the wrong Ajax order.

Commits
-------

4829cbc Fixed the order of update enves in AJAX edits
  • Loading branch information
javiereguiluz committed Oct 6, 2018
2 parents b25ceaa + 4829cbc commit 39c97cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Controller/AdminController.php
Expand Up @@ -417,9 +417,9 @@ protected function updateEntityProperty($entity, $property, $value)
throw new \RuntimeException(sprintf('The "%s" property of the "%s" entity is not writable.', $property, $entityConfig['name']));
}

$this->dispatch(EasyAdminEvents::PRE_UPDATE, array('entity' => $entity, 'newValue' => $value));

$this->get('easy_admin.property_accessor')->setValue($entity, $property, $value);

$this->dispatch(EasyAdminEvents::PRE_UPDATE, array('entity' => $entity, 'newValue' => $value));
$this->executeDynamicMethod('preUpdate<EntityName>Entity', array($entity, true));

$this->em->persist($entity);
Expand Down

0 comments on commit 39c97cd

Please sign in to comment.