Skip to content

Commit f64151a

Browse files
committed
Fixes
1 parent dc6063e commit f64151a

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

lib/Gedmo/AbstractTrackingListener.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,18 @@ public function onFlush(EventArgs $args)
106106
$trackedFields = $options['trackedField'];
107107
}
108108

109+
// foreach ($trackedFields as $tracked) {
110+
// $trackedChild = null;
111+
// $parts = explode('.', $tracked);
112+
// if (isset($parts[1])) {
113+
// $tracked = $parts[0];
114+
// $trackedChild = $parts[1];
115+
// }
116+
117+
109118
foreach ($trackedFields as $trackedField) {
110119
$trackedChild = null;
120+
$tracked = null;
111121
$parts = explode('.', $trackedField);
112122
if (isset($parts[1])) {
113123
$tracked = $parts[0];
@@ -116,7 +126,7 @@ public function onFlush(EventArgs $args)
116126

117127
if (!isset($tracked) || array_key_exists($trackedField, $changeSet)) {
118128
$tracked = $trackedField;
119-
unset($trackedChild);
129+
$trackedChild = null;
120130
}
121131

122132
if (isset($changeSet[$tracked])) {

tests/Gedmo/Timestampable/Fixture/Article.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,9 @@ public function getContentChanged()
177177
{
178178
return $this->contentChanged;
179179
}
180+
181+
public function getAuthorChanged()
182+
{
183+
return $this->authorChanged;
184+
}
180185
}

tests/Gedmo/Timestampable/Fixture/Author.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
class Author
1212
{
1313
/**
14-
* @ORM\Column(name="author_name", type="string", length=128)
14+
* @ORM\Column(name="author_name", type="string", length=128, nullable=true)
1515
*/
1616
private $name;
1717

1818
/**
19-
* @ORM\Column(name="author_email", type="string", length=50)
19+
* @ORM\Column(name="author_email", type="string", length=50, nullable=true)
2020
*/
2121
private $email;
2222

tests/Gedmo/Timestampable/TimestampableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function shouldHandleStandardBehavior()
144144
$this->assertNotSame($su2 = $sport->getUpdated(), $su, "Date updated should change after update");
145145
$this->assertSame($sport->getPublished(), $sp, "Date published should remain the same after update");
146146
$this->assertNotSame($scc2 = $sport->getContentChanged(), $scc, "Content must have changed after update");
147-
$this->assertSame($sport->authorChanged(), $sa, "Author should remain same after update");
147+
$this->assertSame($sport->getAuthorChanged(), $sa, "Author should remain same after update");
148148

149149
$author = $sport->getAuthor();
150150
$author->setName('Third author');

0 commit comments

Comments
 (0)