Skip to content

Commit

Permalink
Merge pull request #13 from ntidev/assoc-bug-fix
Browse files Browse the repository at this point in the history
Association bug fix
  • Loading branch information
bvisonl authored Nov 18, 2020
2 parents 10108c3 + 6366989 commit 9ddabf5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/DataDog/AuditBundle/EventSubscriber/AuditSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,14 @@ protected function assoc(EntityManager $em, $association = null, $diff = false)
}

$meta = get_class($association);
$res = ['class' => $meta, 'typ' => $this->typ($meta), 'tbl' => null, 'label' => null];
$res = ['class' => $meta, 'typ' => $this->typ($meta), 'tbl' => null, 'label' => null, 'createdOn' => new \DateTime()];

try {
$meta = $em->getClassMetadata($meta);
$res['tbl'] = $meta->table['name'];
$em->getUnitOfWork()->initializeObject($association); // ensure that proxies are initialized
$res['fk'] = $this->getUser() != null && $diff == false ? $this->getUser()->getId() : (string)$this->id($em, $association);
$res['label'] = $this->label($em, $association, $diff);
$res['createdOn'] = new \DateTime();
} catch (\Exception $e) {
$res['fk'] = (string) $association->getId();
}
Expand Down

0 comments on commit 9ddabf5

Please sign in to comment.