Skip to content

Commit

Permalink
AdminGrid: onError event
Browse files Browse the repository at this point in the history
  • Loading branch information
pepakriz committed Oct 25, 2014
1 parent 4629661 commit f412ccb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/System/Components/AdminGrid/AdminGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class AdminGrid extends \Venne\System\UI\Control
/** @var callable[] */
public $onClose;

/** @var callable[] */
public $onError;

/** @var \Kdyby\Doctrine\EntityRepository */
private $repository;

Expand Down Expand Up @@ -385,8 +388,12 @@ public function tableDelete($id, $action)
$this->tableDelete($item, null);
}
} else {
$this->repository->getEntityManager()->remove($this->repository->find($id));
$this->repository->getEntityManager()->flush();
try {
$this->repository->getEntityManager()->remove($this->repository->find($id));
$this->repository->getEntityManager()->flush();
} catch (\Exception $e) {
$this->onError($this, $e);
}
}

$this->redirect('this');
Expand Down

0 comments on commit f412ccb

Please sign in to comment.