forked from doctrine-extensions/DoctrineExtensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use dedicated event eventArgs (doctrine-extensions#2649)
* use dedicated eventArgs * fix workflow fails * fix * move functions to appropriate class * move functions to appropriate class * add changelog note * Move presoftdeletable methods * update tests to expect dedicated eventargs instances * Use Pre and Post event args when it is type-hinted --------- Co-authored-by: Fran Moreno <franmomu@gmail.com>
- Loading branch information
Showing
14 changed files
with
337 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\SoftDeleteable\Event; | ||
|
||
use Doctrine\Persistence\Event\LifecycleEventArgs; | ||
use Doctrine\Persistence\ObjectManager; | ||
|
||
/** | ||
* @template TObjectManager of ObjectManager | ||
* | ||
* @template-extends LifecycleEventArgs<TObjectManager> | ||
*/ | ||
final class PostSoftDeleteEventArgs extends LifecycleEventArgs | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\SoftDeleteable\Event; | ||
|
||
use Doctrine\Persistence\Event\LifecycleEventArgs; | ||
use Doctrine\Persistence\ObjectManager; | ||
|
||
/** | ||
* @template TObjectManager of ObjectManager | ||
* | ||
* @template-extends LifecycleEventArgs<TObjectManager> | ||
*/ | ||
final class PreSoftDeleteEventArgs extends LifecycleEventArgs | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/Gedmo/SoftDeleteable/Fixture/Listener/WithLifecycleEventArgsFromODMTypeListener.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\Tests\SoftDeleteable\Fixture\Listener; | ||
|
||
use Doctrine\Common\EventSubscriber; | ||
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs; | ||
use Gedmo\SoftDeleteable\SoftDeleteableListener; | ||
|
||
final class WithLifecycleEventArgsFromODMTypeListener implements EventSubscriber | ||
{ | ||
public function preSoftDelete(LifecycleEventArgs $args): void | ||
{ | ||
} | ||
|
||
public function postSoftDelete(LifecycleEventArgs $args): void | ||
{ | ||
} | ||
|
||
public function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
SoftDeleteableListener::PRE_SOFT_DELETE, | ||
SoftDeleteableListener::POST_SOFT_DELETE, | ||
]; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
tests/Gedmo/SoftDeleteable/Fixture/Listener/WithLifecycleEventArgsFromORMTypeListener.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\Tests\SoftDeleteable\Fixture\Listener; | ||
|
||
use Doctrine\Common\EventSubscriber; | ||
use Doctrine\ORM\Event\LifecycleEventArgs; | ||
use Gedmo\SoftDeleteable\SoftDeleteableListener; | ||
|
||
final class WithLifecycleEventArgsFromORMTypeListener implements EventSubscriber | ||
{ | ||
public function preSoftDelete(LifecycleEventArgs $args): void | ||
{ | ||
} | ||
|
||
public function postSoftDelete(LifecycleEventArgs $args): void | ||
{ | ||
} | ||
|
||
public function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
SoftDeleteableListener::PRE_SOFT_DELETE, | ||
SoftDeleteableListener::POST_SOFT_DELETE, | ||
]; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...s/Gedmo/SoftDeleteable/Fixture/Listener/WithPreAndPostSoftDeleteEventArgsTypeListener.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\Tests\SoftDeleteable\Fixture\Listener; | ||
|
||
use Doctrine\Common\EventSubscriber; | ||
use Doctrine\Persistence\ObjectManager; | ||
use Gedmo\SoftDeleteable\Event\PostSoftDeleteEventArgs; | ||
use Gedmo\SoftDeleteable\Event\PreSoftDeleteEventArgs; | ||
use Gedmo\SoftDeleteable\SoftDeleteableListener; | ||
|
||
final class WithPreAndPostSoftDeleteEventArgsTypeListener implements EventSubscriber | ||
{ | ||
/** @param PreSoftDeleteEventArgs<ObjectManager> $args */ | ||
public function preSoftDelete(PreSoftDeleteEventArgs $args): void | ||
{ | ||
} | ||
|
||
/** @param PostSoftDeleteEventArgs<ObjectManager> $args */ | ||
public function postSoftDelete(PostSoftDeleteEventArgs $args): void | ||
{ | ||
} | ||
|
||
public function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
SoftDeleteableListener::PRE_SOFT_DELETE, | ||
SoftDeleteableListener::POST_SOFT_DELETE, | ||
]; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
tests/Gedmo/SoftDeleteable/Fixture/Listener/WithoutTypeListener.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\Tests\SoftDeleteable\Fixture\Listener; | ||
|
||
use Doctrine\Common\EventSubscriber; | ||
use Doctrine\Persistence\ObjectManager; | ||
use Gedmo\SoftDeleteable\Event\PostSoftDeleteEventArgs; | ||
use Gedmo\SoftDeleteable\Event\PreSoftDeleteEventArgs; | ||
use Gedmo\SoftDeleteable\SoftDeleteableListener; | ||
|
||
final class WithoutTypeListener implements EventSubscriber | ||
{ | ||
/** @param PreSoftDeleteEventArgs<ObjectManager> $args */ | ||
public function preSoftDelete($args): void | ||
{ | ||
} | ||
|
||
/** @param PostSoftDeleteEventArgs<ObjectManager> $args */ | ||
public function postSoftDelete($args): void | ||
{ | ||
} | ||
|
||
public function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
SoftDeleteableListener::PRE_SOFT_DELETE, | ||
SoftDeleteableListener::POST_SOFT_DELETE, | ||
]; | ||
} | ||
} |
Oops, something went wrong.