Skip to content

Commit

Permalink
Allow auditing of entities with many-many relations
Browse files Browse the repository at this point in the history
The changes made in c619a4e have made
it impossible to load the history of entities that have a many to many
relationship with another entity. I think the old approach of just
providing an empty collection and the notice in the docs is preferable
to not being able to audit the entity at all. Hence I reverted the
change that throws an exception if a many to many relationship is found
  • Loading branch information
tommygnr committed Dec 9, 2014
1 parent 65825a8 commit 98b6647
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/SimpleThings/EntityAudit/AuditReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ private function createEntity($className, array $data, $revision)
$class->reflFields[$assoc['fieldName']]->setValue($entity, $collection);
}
} else {
throw new \Exception(sprintf('Association type %d is not yet supported', $assoc['type']));
// Inject collection
$reflField = $class->reflFields[$field];
$reflField->setValue($entity, new ArrayCollection);
}
}

Expand Down

0 comments on commit 98b6647

Please sign in to comment.