Skip to content

Commit

Permalink
Fix new version when touched by related model #11
Browse files Browse the repository at this point in the history
Fixes: When ModelA is be updated and touches ModelB the VersionableTrait
also creates a version for ModelB, even if it is not modified. Fix by
mk-conn, just packaged up into a pull request by geoffbeaumont.
  • Loading branch information
geoffbeaumont committed Oct 6, 2016
1 parent eee7b9b commit 8d5a3b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Mpociot/Versionable/VersionableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function versionablePostSave()
*/
if (
( $this->versioningEnabled === true && $this->updating && $this->isValidForVersioning() ) ||
( $this->versioningEnabled === true && !$this->updating )
( $this->versioningEnabled === true && !$this->updating && count($this->versionableDirtyData))
) {
// Save a new version
$version = new Version();
Expand Down

0 comments on commit 8d5a3b5

Please sign in to comment.