Skip to content

Commit

Permalink
Fixed failing test for blameable
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Miehe committed May 8, 2014
1 parent 6120bd0 commit ecf70f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Gedmo/Blameable/BlameableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ protected function updateField($object, $ea, $meta, $field)
$oldValue = $property->getValue($object);
$newValue = $this->getUserValue($meta, $field);

//if blame is reference, persist object
if ($meta->hasAssociation($field)) {
$ea->getObjectManager()->persist($newValue);
}
$property->setValue($object, $newValue);
if ($object instanceof NotifyPropertyChanged) {
$uow = $ea->getObjectManager()->getUnitOfWork();
Expand Down

2 comments on commit ecf70f0

@tjurdzinski
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible that $ newValue is empty.

I get similar error:
#1233

Solve the problem of change line 85 to:
if ($meta->hasAssociation($field) && !is_null($newValue)) {

@lucagtc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already pull request #1235.

+1 to merge

Please sign in to comment.