- Added Events to repository and entitytrait objects. Some more work to be done on this.
- Diverses bug fixes linked to join and relations - Field date and datetime are now outputed using given locale.
This commit is contained in:
1 parent
1839726dc0
commit
4d221859fc
15 files changed
+421
-99
No files matched your search
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus;
|
||||
|
||||
trait EventTrait
|
||||
{
|
||||
public array $eventList = [];
|
||||
|
||||
public function eventRegister(object $event) : void
|
||||
{
|
||||
$this->eventList[] = $event;
|
||||
}
|
||||
|
||||
public function eventFromType(string $type) : array
|
||||
{
|
||||
return array_filter($this->eventList, fn($ev) => $ev instanceof $type);
|
||||
}
|
||||
|
||||
public function eventExecute(string $type, ...$arguments) : void
|
||||
{
|
||||
foreach($this->eventFromType($type) as $event) {
|
||||
call_user_func_array([ $event, 'execute'], $arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user