-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2078a66
commit 424a5cc
Showing
21 changed files
with
397 additions
and
144 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Distantmagic\Resonance\Attribute; | ||
|
||
use Attribute; | ||
use Distantmagic\Resonance\Attribute as BaseAttribute; | ||
|
||
#[Attribute(Attribute::TARGET_CLASS)] | ||
final readonly class ListensToDoctrineEntityEvents extends BaseAttribute | ||
{ | ||
/** | ||
* @param class-string $className | ||
*/ | ||
public function __construct(public string $className) {} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Distantmagic\Resonance\Attribute; | ||
|
||
use Attribute; | ||
use Distantmagic\Resonance\Attribute as BaseAttribute; | ||
|
||
#[Attribute(Attribute::TARGET_CLASS)] | ||
final readonly class ListensToDoctrineEvents extends BaseAttribute {} |
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,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Distantmagic\Resonance; | ||
|
||
abstract readonly class DoctrineEntityListener {} |
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Distantmagic\Resonance; | ||
|
||
use Ds\Map; | ||
use Ds\Set; | ||
|
||
readonly class DoctrineEntityListenerCollection | ||
{ | ||
/** | ||
* @var Map<class-string,Set<object>> | ||
*/ | ||
public Map $listeners; | ||
|
||
public function __construct() | ||
{ | ||
$this->listeners = new Map(); | ||
} | ||
|
||
/** | ||
* @param class-string $className | ||
*/ | ||
public function addEntityListener(string $className, object $listener): void | ||
{ | ||
if (!$this->listeners->hasKey($className)) { | ||
$this->listeners->put($className, new Set()); | ||
} | ||
|
||
$this->listeners->get($className)->add($listener); | ||
} | ||
} |
Oops, something went wrong.