Skip to content

Commit

Permalink
Audit operations were stored in reverse order in transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienHarper committed Apr 27, 2020
1 parent e3cc043 commit e01d871
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/DoctrineAuditBundle/Manager/AuditTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function collect(): void
*/
public function collectScheduledInsertions(UnitOfWork $uow): void
{
foreach ($uow->getScheduledEntityInsertions() as $entity) {
foreach (array_reverse($uow->getScheduledEntityInsertions()) as $entity) {
if ($this->configuration->isAudited($entity)) {
$this->inserted[] = [
$entity,
Expand All @@ -105,7 +105,7 @@ public function collectScheduledInsertions(UnitOfWork $uow): void
*/
public function collectScheduledUpdates(UnitOfWork $uow): void
{
foreach ($uow->getScheduledEntityUpdates() as $entity) {
foreach (array_reverse($uow->getScheduledEntityUpdates()) as $entity) {
if ($this->configuration->isAudited($entity)) {
$this->updated[] = [
$entity,
Expand All @@ -124,7 +124,7 @@ public function collectScheduledUpdates(UnitOfWork $uow): void
*/
public function collectScheduledDeletions(UnitOfWork $uow, EntityManagerInterface $em): void
{
foreach ($uow->getScheduledEntityDeletions() as $entity) {
foreach (array_reverse($uow->getScheduledEntityDeletions()) as $entity) {
if ($this->configuration->isAudited($entity)) {
$uow->initializeObject($entity);
$this->removed[] = [
Expand All @@ -144,7 +144,7 @@ public function collectScheduledDeletions(UnitOfWork $uow, EntityManagerInterfac
*/
public function collectScheduledCollectionUpdates(UnitOfWork $uow, EntityManagerInterface $em): void
{
foreach ($uow->getScheduledCollectionUpdates() as $collection) {
foreach (array_reverse($uow->getScheduledCollectionUpdates()) as $collection) {
if ($this->configuration->isAudited($collection->getOwner())) {
$mapping = $collection->getMapping();
foreach ($collection->getInsertDiff() as $entity) {
Expand Down Expand Up @@ -179,7 +179,7 @@ public function collectScheduledCollectionUpdates(UnitOfWork $uow, EntityManager
*/
public function collectScheduledCollectionDeletions(UnitOfWork $uow, EntityManagerInterface $em): void
{
foreach ($uow->getScheduledCollectionDeletions() as $collection) {
foreach (array_reverse($uow->getScheduledCollectionDeletions()) as $collection) {
if ($this->configuration->isAudited($collection->getOwner())) {
$mapping = $collection->getMapping();
foreach ($collection->toArray() as $entity) {
Expand Down

0 comments on commit e01d871

Please sign in to comment.