Skip to content

Commit

Permalink
Handle TableNotFoundException. (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
Herz3h authored Nov 10, 2020
1 parent 6ac7073 commit 7bd697b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/DoctrineAuditBundle/Event/AuditSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace DH\DoctrineAuditBundle\Event;

use DH\DoctrineAuditBundle\Manager\AuditManager;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AuditSubscriber implements EventSubscriberInterface
Expand Down Expand Up @@ -61,11 +62,18 @@ public function onAuditEvent(LifecycleEvent $event): LifecycleEvent
$storage = $this->manager->selectStorageSpace($this->manager->getConfiguration()->getEntityManager());
$statement = $storage->getConnection()->prepare($query);

foreach ($payload as $key => $value) {
foreach ($payload as $key => $value)
{
$statement->bindValue($key, $value);
}

$statement->execute();
try
{
$statement->execute();
}
catch (TableNotFoundException $e)
{
}

return $event;
}
Expand Down

0 comments on commit 7bd697b

Please sign in to comment.