Files
awo-hamburg-intranet/mysyde/common/traits/hookableTrait.php
2026-02-17 14:56:23 +01:00

38 lines
912 B
PHP

<?php
namespace DynCom\mysyde\common\traits;
use DynCom\mysyde\common\classes\Hook;
/**
* Created by PhpStorm.
* User: Bauer
* Date: 15.07.2015
* Time: 11:20
*/
trait hookableTrait
{
/**
* @param $eventName
* @param $data
*/
protected function updateHooks($eventName, $data)
{
$parents = class_parents($this);
$interfaces = class_implements($this);
$className = get_class($this);
$notificationTargets = [$className];
$namespace = '';
foreach ($parents as $parent) {
$notificationTargets[] = $parent;
}
foreach ($interfaces as $interface) {
$notificationTargets[] = $interface;
}
foreach ($notificationTargets as $target) {
Hook::update($eventName, $data, $target);
}
Hook::update($eventName, $data);
}
}