diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c892f8..70d282a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: operating-system: [ ubuntu-latest ] - php-versions: [ '8.1', '8.2', '8.3' ] + php-versions: [ '8.1', '8.2', '8.3', '8.4' ] steps: - name: Checkout diff --git a/Attribute/SubscribeDoctrineEvents.php b/Attribute/SubscribeDoctrineEvents.php index 81e2760..6577d1e 100644 --- a/Attribute/SubscribeDoctrineEvents.php +++ b/Attribute/SubscribeDoctrineEvents.php @@ -16,22 +16,35 @@ * * @author Roni Saha */ - #[\Attribute(\Attribute::TARGET_CLASS)] -/* @final */ class SubscribeDoctrineEvents +/* @final */ +class SubscribeDoctrineEvents { - public $events = array(); + public array $events = []; - public function __construct(array $values) + public function __construct(array|string $values) { - if (isset($values['value'])) { - $values['events'] = $values['value']; - } - if (!isset($values['events'])) { + $validValues = [ + 'created', + 'updated', + ]; + $valueValueStr = [ + 'created,updated', + 'created, updated', + 'updated,created', + 'updated, created', + ]; + if (!empty($values) && is_string($values) && !in_array($values, $valueValueStr)) { return; } - - $this->events = is_array($values['events']) ? $values['events'] : array_map('trim', explode(',', $values['events'])); + if (!empty($values) && is_array($values)) { + foreach ($values as $value) { + if (!in_array($value, $validValues)) { + return; + } + } + } + $this->events = is_array($values) ? $values : array_map('trim', explode(',', $values)); $this->events = array_filter($this->events); } diff --git a/Common/ClassUtils.php b/Common/ClassUtils.php new file mode 100644 index 0000000..2b14d47 --- /dev/null +++ b/Common/ClassUtils.php @@ -0,0 +1,17 @@ +getDoctrine()->getManager(); } @@ -51,7 +51,7 @@ protected function getManager() /** * @return ManagerRegistry */ - public function getDoctrine() + public function getDoctrine(): ManagerRegistry { return $this->doctrine; } @@ -59,13 +59,13 @@ public function getDoctrine() /** * @param AuditLog $event */ - protected function saveLog(AuditLog $event) + protected function saveLog(AuditLog $event): void { $this->getManager()->persist($event); $this->getManager()->flush($event); } - public function savePendingLogs() + public function savePendingLogs(): void { foreach ($this->entityDeleteLogs as $log) { $this->saveLog($log); diff --git a/Logger/MonologLogger.php b/Logger/MonologLogger.php index 40dbbe4..a215c15 100644 --- a/Logger/MonologLogger.php +++ b/Logger/MonologLogger.php @@ -24,7 +24,7 @@ public function __construct(private \Psr\Log\LoggerInterface $logger) } #[\Override] - public function log(AuditLog $event = null) + public function log(?AuditLog $event = null) { if (null === $event) { return; diff --git a/Resolver/DoctrineObjectEventResolver.php b/Resolver/DoctrineObjectEventResolver.php index 765e671..9cd967f 100644 --- a/Resolver/DoctrineObjectEventResolver.php +++ b/Resolver/DoctrineObjectEventResolver.php @@ -12,10 +12,10 @@ namespace Xiidea\EasyAuditBundle\Resolver; use Doctrine\Persistence\ManagerRegistry; -use Doctrine\Common\Util\ClassUtils; use Symfony\Contracts\EventDispatcher\Event; -use Xiidea\EasyAuditBundle\Events\DoctrineObjectEvent; +use Xiidea\EasyAuditBundle\Common\ClassUtils; use Xiidea\EasyAuditBundle\Events\DoctrineEvents; +use Xiidea\EasyAuditBundle\Events\DoctrineObjectEvent; /** Custom Event Resolver Example Class */ class DoctrineObjectEventResolver implements EventResolverInterface @@ -81,7 +81,7 @@ protected function getSingleIdentity() /** * @param DoctrineObjectEvent $event - * @param string $eventName + * @param string $eventName */ private function initialize(DoctrineObjectEvent $event, $eventName) { diff --git a/Subscriber/DoctrineSubscriber.php b/Subscriber/DoctrineSubscriber.php index f4c6198..4f7669c 100644 --- a/Subscriber/DoctrineSubscriber.php +++ b/Subscriber/DoctrineSubscriber.php @@ -11,17 +11,17 @@ namespace Xiidea\EasyAuditBundle\Subscriber; -use Doctrine\Common\Util\ClassUtils; use Doctrine\Persistence\Event\LifecycleEventArgs; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Xiidea\EasyAuditBundle\Attribute\SubscribeDoctrineEvents; +use Xiidea\EasyAuditBundle\Common\ClassUtils; use Xiidea\EasyAuditBundle\Events\DoctrineEvents; use Xiidea\EasyAuditBundle\Events\DoctrineObjectEvent; class DoctrineSubscriber { private array $toBeDeleted = []; - private $dispatcher = null; + private $dispatcher = null; public function __construct(private array $entities = []) { @@ -71,10 +71,10 @@ private function getToBeDeletedId($entity) } /** - * @param string $eventName - * @param LifecycleEventArgs $args + * @param string $eventName + * @param LifecycleEventArgs $args */ - private function handleEvent($eventName, LifecycleEventArgs $args) + private function handleEvent($eventName, LifecycleEventArgs $args): void { if (true === $this->isConfiguredToTrack($args->getObject(), $eventName)) { $this->dispatcher->dispatch( @@ -86,7 +86,7 @@ private function handleEvent($eventName, LifecycleEventArgs $args) /** * @param $entity - * @param string $eventName + * @param string $eventName * * @return bool */ @@ -131,8 +131,8 @@ protected function isAttributedEvent($entity, $eventType) /** - * @param string $eventType - * @param string $class + * @param string $eventType + * @param string $class * * @return bool */ @@ -142,7 +142,7 @@ private function shouldTrackEventType($eventType, $class) } /** - * @param string $class + * @param string $class * * @return bool */ @@ -152,7 +152,7 @@ private function shouldTrackAllEventType($class) } /** - * @param LifecycleEventArgs $args + * @param LifecycleEventArgs $args * @param $className * * @return array @@ -179,7 +179,7 @@ private function isScheduledForDelete($entity) } /** - * @param EventDispatcherInterface $dispatcher + * @param EventDispatcherInterface $dispatcher */ public function setDispatcher($dispatcher) { diff --git a/Tests/Attribute/SubscribeDoctrineEventsTest.php b/Tests/Attribute/SubscribeDoctrineEventsTest.php index 1be9671..a165ad2 100644 --- a/Tests/Attribute/SubscribeDoctrineEventsTest.php +++ b/Tests/Attribute/SubscribeDoctrineEventsTest.php @@ -18,7 +18,7 @@ class SubscribeDoctrineEventsTest extends TestCase { public function testConstructWithoutData() { - $annotation = new SubscribeDoctrineEvents(array()); + $annotation = new SubscribeDoctrineEvents([]); $this->assertTrue(is_array($annotation->events)); $this->assertEmpty($annotation->events); @@ -26,10 +26,10 @@ public function testConstructWithoutData() public function testConstructWithInvalidData() { - $data = array( + $data = [ 'unknown' => 'foo', - 'array' => array('bar' => 'bar'), - ); + 'array' => ['bar' => 'bar'], + ]; $annotation = new SubscribeDoctrineEvents($data); @@ -39,25 +39,13 @@ public function testConstructWithInvalidData() public function testConstructWithValue() { - $data = array('value' => 'updated,created'); + $data = 'created,updated'; $annotation = new SubscribeDoctrineEvents($data); $this->assertTrue(is_array($annotation->events)); $this->assertNotEmpty($annotation->events); - $this->assertEquals(explode(',', $data['value']), $annotation->events); - } - - public function testConstructWithEvent() - { - $data = array('events' => 'updated,created'); - - $annotation = new SubscribeDoctrineEvents($data); - - $this->assertTrue(is_array($annotation->events)); - $this->assertNotEmpty($annotation->events); - - $this->assertEquals(explode(',', $data['events']), $annotation->events); + $this->assertEquals(explode(',', $data), $annotation->events); } } diff --git a/Tests/Common/ClassUtilTest.php b/Tests/Common/ClassUtilTest.php new file mode 100644 index 0000000..6c62fb1 --- /dev/null +++ b/Tests/Common/ClassUtilTest.php @@ -0,0 +1,40 @@ +assertSame(DummyClass::class, $result); + } + + public function testGetClassWithProxyObject() + { + $proxy = new DummyProxyClass(); + $result = ClassUtils::getClass($proxy); + $this->assertSame(DummyClass::class, $result); + } +} \ No newline at end of file diff --git a/Tests/Fixtures/ODM/UnitOfWork.php b/Tests/Fixtures/ODM/UnitOfWork.php index 4d78e60..51f495a 100644 --- a/Tests/Fixtures/ODM/UnitOfWork.php +++ b/Tests/Fixtures/ODM/UnitOfWork.php @@ -10,12 +10,12 @@ class UnitOfWork implements PropertyChangedListener /** * Collect information about a property change. * - * @param object $sender the object on which the property changed + * @param object $sender the object on which the property changed * @param string $propertyName the name of the property that changed - * @param mixed $oldValue the old value of the property that changed - * @param mixed $newValue the new value of the property that changed + * @param mixed $oldValue the old value of the property that changed + * @param mixed $newValue the new value of the property that changed */ - public function propertyChanged($sender, $propertyName, $oldValue, $newValue) + public function propertyChanged(object $sender, string $propertyName, mixed $oldValue, mixed $newValue): void { } diff --git a/Tests/Fixtures/ORM/Book.php b/Tests/Fixtures/ORM/Book.php new file mode 100644 index 0000000..cc5c74e --- /dev/null +++ b/Tests/Fixtures/ORM/Book.php @@ -0,0 +1,56 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Xiidea\EasyAuditBundle\Tests\Fixtures\ORM; + +use Doctrine\ORM\Mapping as ORM; +use Xiidea\EasyAuditBundle\Attribute\SubscribeDoctrineEvents; + +/** + * @ORM\Entity + */ +#[SubscribeDoctrineEvents(['updated'])] +#[ORM\Entity] +class Book +{ + + #[ORM\Id] + #[ORM\Column(type: 'integer')] + #[ORM\GeneratedValue(strategy: "AUTO")] + protected $id; + + #[ORM\Column(type: 'string')] + protected $name; + + public function __construct($id = 1, $name = 'car') + { + $this->id = $id; + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } +} diff --git a/Tests/Fixtures/ORM/Machine.php b/Tests/Fixtures/ORM/Machine.php new file mode 100644 index 0000000..5091999 --- /dev/null +++ b/Tests/Fixtures/ORM/Machine.php @@ -0,0 +1,54 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Xiidea\EasyAuditBundle\Tests\Fixtures\ORM; + +use Doctrine\ORM\Mapping as ORM; +use Xiidea\EasyAuditBundle\Attribute\SubscribeDoctrineEvents; + + +#[SubscribeDoctrineEvents([])] +#[ORM\Entity] +class Machine +{ + + #[ORM\Id] + #[ORM\Column(type: 'integer')] + #[ORM\GeneratedValue(strategy: "AUTO")] + protected $id; + + #[ORM\Column(type: 'string')] + protected $name; + + public function __construct($id = 1, $name = 'car') + { + $this->id = $id; + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } +} diff --git a/Tests/Fixtures/ORM/Movie.php b/Tests/Fixtures/ORM/Movie.php index 12e57bd..0954520 100644 --- a/Tests/Fixtures/ORM/Movie.php +++ b/Tests/Fixtures/ORM/Movie.php @@ -17,23 +17,16 @@ /** * @ORM\Entity */ -#[SubscribeDoctrineEvents([])] +#[SubscribeDoctrineEvents(['created'])] #[ORM\Entity] class Movie { - /** - * @ORM\Id - * @ORM\Column(type="integer") - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue(strategy: "AUTO")] protected $id; - /** - * @ORM\Column(type="string") - */ #[ORM\Column(type: 'string')] protected $name; diff --git a/Tests/Fixtures/ORM/TestMovie.php b/Tests/Fixtures/ORM/TestMovie.php new file mode 100644 index 0000000..be25ece --- /dev/null +++ b/Tests/Fixtures/ORM/TestMovie.php @@ -0,0 +1,59 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Xiidea\EasyAuditBundle\Tests\Fixtures\ORM; + +use Doctrine\ORM\Mapping as ORM; +use Xiidea\EasyAuditBundle\Attribute\SubscribeDoctrineEvents; + +#[ORM\Entity] +class TestMovie +{ + /** + * @ORM\Id + * @ORM\Column(type="integer") + * @ORM\GeneratedValue(strategy="AUTO") + */ + #[ORM\Id] + #[ORM\Column(type: 'integer')] + #[ORM\GeneratedValue(strategy: "AUTO")] + protected $id; + + /** + * @ORM\Column(type="string") + */ + #[ORM\Column(type: 'string')] + protected $name; + + public function __construct($id = 1, $name = 'car') + { + $this->id = $id; + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } +} diff --git a/Tests/Fixtures/ORM/UnitOfWork.php b/Tests/Fixtures/ORM/UnitOfWork.php index a093e6c..a15014f 100644 --- a/Tests/Fixtures/ORM/UnitOfWork.php +++ b/Tests/Fixtures/ORM/UnitOfWork.php @@ -10,12 +10,12 @@ class UnitOfWork implements PropertyChangedListener /** * Collect information about a property change. * - * @param object $sender the object on which the property changed + * @param object $sender the object on which the property changed * @param string $propertyName the name of the property that changed - * @param mixed $oldValue the old value of the property that changed - * @param mixed $newValue the new value of the property that changed + * @param mixed $oldValue the old value of the property that changed + * @param mixed $newValue the new value of the property that changed */ - public function propertyChanged($sender, $propertyName, $oldValue, $newValue) + public function propertyChanged(object $sender, string $propertyName, mixed $oldValue, mixed $newValue): void { } diff --git a/Tests/Fixtures/ORM/UserEntity.php b/Tests/Fixtures/ORM/UserEntity.php index 40a7b04..4b2398c 100644 --- a/Tests/Fixtures/ORM/UserEntity.php +++ b/Tests/Fixtures/ORM/UserEntity.php @@ -58,7 +58,7 @@ public function getId() return $this->id; } - public function __toString() + public function __toString(): string { return $this->getUsername(); } @@ -81,7 +81,7 @@ public function getRoles(): array * * @see AccountExpiredException */ - public function isAccountNonExpired() + public function isAccountNonExpired(): bool { return true; } @@ -96,7 +96,7 @@ public function isAccountNonExpired() * * @see LockedException */ - public function isAccountNonLocked() + public function isAccountNonLocked(): bool { return true; } @@ -111,7 +111,7 @@ public function isAccountNonLocked() * * @see CredentialsExpiredException */ - public function isCredentialsNonExpired() + public function isCredentialsNonExpired(): bool { return true; } @@ -126,7 +126,7 @@ public function isCredentialsNonExpired() * * @see DisabledException */ - public function isEnabled() + public function isEnabled(): bool { return true; } @@ -156,7 +156,7 @@ public function serialize() * * @since 5.1.0 */ - public function unserialize($serialized) + public function unserialize($serialized): void { return; } @@ -166,7 +166,7 @@ public function unserialize($serialized) * * @return static */ - public function setSalt($salt) + public function setSalt($salt): static { return $this; } @@ -178,7 +178,7 @@ public function setSalt($salt) * * @return static */ - public function setPlainPassword($password) + public function setPlainPassword($password): static { return $this; } @@ -190,7 +190,7 @@ public function setPlainPassword($password) * * @return static */ - public function setPassword($password) + public function setPassword($password): static { return $this; } @@ -200,7 +200,7 @@ public function setPassword($password) * * @return bool */ - public function isSuperAdmin() + public function isSuperAdmin(): bool { return true; } @@ -212,20 +212,13 @@ public function isSuperAdmin() * * @return static */ - public function setLastLogin(\DateTime $time = null) + public function setLastLogin(?\DateTime $time = null) { return $this; } - /** - * Returns the password used to authenticate the user. - * - * This should be the encoded password. On authentication, a plain-text - * password will be salted, encoded, and then compared to this value. - * - * @return string The password - */ - public function getPassword() + + public function getPassword(): void { return; } @@ -237,7 +230,7 @@ public function getPassword() * * @return string|null The salt */ - public function getSalt() + public function getSalt(): void { return; } @@ -358,7 +351,7 @@ public function setConfirmationToken($confirmationToken) * * @return static */ - public function setPasswordRequestedAt(\DateTime $date = null) + public function setPasswordRequestedAt(?\DateTime $date = null) { return $this; } diff --git a/Tests/Functional/Bundle/TestBundle/Logger/FileLogger.php b/Tests/Functional/Bundle/TestBundle/Logger/FileLogger.php index 3740e8c..3e66a65 100644 --- a/Tests/Functional/Bundle/TestBundle/Logger/FileLogger.php +++ b/Tests/Functional/Bundle/TestBundle/Logger/FileLogger.php @@ -24,7 +24,7 @@ public function __construct($dir) $this->dir = $dir; } - public function log(AuditLog $event = null) + public function log(?AuditLog $event = null) { if (empty($event)) { return; diff --git a/Tests/Functional/ImpersonatingUserTest.php b/Tests/Functional/ImpersonatingUserTest.php index dd98317..a060a68 100644 --- a/Tests/Functional/ImpersonatingUserTest.php +++ b/Tests/Functional/ImpersonatingUserTest.php @@ -11,9 +11,9 @@ namespace Xiidea\EasyAuditBundle\Tests\Functional; +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\DomCrawler\Crawler; use Xiidea\EasyAuditBundle\Tests\Functional\Bundle\TestBundle\Controller\DefaultController; -use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class ImpersonatingUserTest extends WebTestCase { @@ -38,7 +38,7 @@ public function testSecuredEventWithImpersonatingUser() $name = 'simple.event'; $this->client->request('GET', "/some-secure-url/{$name}", [], [], [ - "HTTP_AUTHORIZATION" => "Basic " . base64_encode("admin:login") + "HTTP_AUTHORIZATION" => "Basic ".base64_encode("admin:login"), ]); $crawler = $this->client->request('GET', "/some-secure-url/{$name}?_switch_user=user"); $this->assertTrue($this->client->getResponse()->isSuccessful()); @@ -71,7 +71,7 @@ private function getEventArrayFromResponse(Crawler $crawler): array { $html = $crawler->html(); $parts = explode(DefaultController::RESPONSE_BOUNDARY, $html); - $event = unserialize($parts[1]); - return $event; + + return unserialize($parts[1]); } } diff --git a/Tests/Subscriber/DoctrineSubscriberTest.php b/Tests/Subscriber/DoctrineSubscriberTest.php index 47f072e..e320f5c 100644 --- a/Tests/Subscriber/DoctrineSubscriberTest.php +++ b/Tests/Subscriber/DoctrineSubscriberTest.php @@ -13,19 +13,19 @@ use Doctrine\Persistence\Event\LifecycleEventArgs; use Doctrine\Persistence\Mapping\ClassMetadata; +use Doctrine\Persistence\ObjectManager; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Xiidea\EasyAuditBundle\Subscriber\DoctrineSubscriber; -use Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\DummyEntity; +use Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Book; +use Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Machine; use Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Movie; -use Doctrine\Persistence\ObjectManager; class DoctrineSubscriberTest extends TestCase { /** @var MockObject */ private $dispatcher; - /** @var MockObject */ private $entityManager; @@ -45,72 +45,79 @@ public function setUp(): void public function testCreateEventForAttributedEntity() { - $subscriber = new DoctrineSubscriber(array()); + $subscriber = new DoctrineSubscriber([]); $this->invokeCreatedEventCall($subscriber); + $this->assertTrue(true); } public function testCreateEventForEntityNotConfiguredToTrack() { - $subscriber = new DoctrineSubscriber(array()); - $this->invokeCreatedEventCall($subscriber, new DummyEntity()); + $subscriber = new DoctrineSubscriber([]); + $this->invokeCreatedEventCall($subscriber); + $this->assertTrue(true); } public function testCreateEventForEntityConfiguredToTrack() { - $subscriber = new DoctrineSubscriber( - array('Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Movie' => array('created')) - ); + $subscriber = new DoctrineSubscriber(['Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Movie' => ['created']]); $this->invokeCreatedEventCall($subscriber); + $this->assertTrue(true); } public function testCreateEventForEntityConfiguredToTrackAllEvents() { - $subscriber = new DoctrineSubscriber(array('Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Movie' => array())); + $subscriber = new DoctrineSubscriber(['Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Movie' => []]); $this->invokeCreatedEventCall($subscriber); + $this->assertTrue(true); } public function testUpdateEventForEntityNotConfiguredToTrack() { - $subscriber = new DoctrineSubscriber(array()); - $this->invokeUpdatedEventCall($subscriber, new DummyEntity()); + $subscriber = new DoctrineSubscriber([]); + $this->invokeUpdatedEventCall($subscriber); + $this->assertTrue(true); } public function testRemovedEventForEntityNotConfiguredToTrack() { - $subscriber = new DoctrineSubscriber(array()); + $subscriber = new DoctrineSubscriber([]); $this->invokeDeletedEventCall($subscriber); + $this->assertTrue(true); } public function testRemovedEventForEntityConfiguredToTrackAllEvent() { $this->mockMetaData(); - $subscriber = new DoctrineSubscriber(array('Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Movie' => array())); + $subscriber = new DoctrineSubscriber(['Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\Movie' => []]); $this->invokeDeletedEventCall($subscriber); + $this->assertTrue(true); } /** * @param DoctrineSubscriber $subscriber */ - private function invokeCreatedEventCall($subscriber, $entity = null) + private function invokeCreatedEventCall($subscriber) { $subscriber->setDispatcher($this->dispatcher); - $subscriber->postPersist(new LifecycleEventArgs($entity ?? new Movie(), $this->entityManager)); + + $subscriber->postPersist(new LifecycleEventArgs(new Movie(), $this->entityManager)); + $subscriber->postPersist(new LifecycleEventArgs(new Machine(), $this->entityManager)); $this->assertTrue(true); } /** * @param DoctrineSubscriber $subscriber */ - private function invokeUpdatedEventCall($subscriber, $entity = null) + private function invokeUpdatedEventCall($subscriber) { $subscriber->setDispatcher($this->dispatcher); - $subscriber->postUpdate(new LifecycleEventArgs($entity ?? new Movie(), $this->entityManager)); - $this->assertTrue(true); + $subscriber->postUpdate(new LifecycleEventArgs(new Book(), $this->entityManager)); + $subscriber->postUpdate(new LifecycleEventArgs(new Machine(), $this->entityManager)); } /** @@ -119,6 +126,7 @@ private function invokeUpdatedEventCall($subscriber, $entity = null) private function invokeDeletedEventCall($subscriber) { $subscriber->setDispatcher($this->dispatcher); + $movie = new Movie(); $subscriber->preRemove(new LifecycleEventArgs($movie, $this->entityManager)); $subscriber->postRemove(new LifecycleEventArgs($movie, $this->entityManager));