Add event action storage. Closes #2344

This commit is contained in:
James Brooks
2017-02-03 22:34:13 +00:00
parent c2790e29cc
commit 3dc154dff1
92 changed files with 1512 additions and 128 deletions

View File

@@ -11,15 +11,24 @@
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\IncidentUpdate;
use CachetHQ\Cachet\Models\User;
/**
* This is the incident update was removed event.
*
* @author James Brooks <james@alt-three.com>
*/
final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterface
final class IncidentUpdateWasRemovedEvent implements ActionInterface, IncidentUpdateEventInterface
{
/**
* The user who removed the incident update.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* The incident update that has been removed.
*
@@ -30,12 +39,14 @@ final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterfac
/**
* Create a new incident update was removed event instance.
*
* @param \CachetHQ\Cachet\Models\User $user
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
*
* @return void
*/
public function __construct(IncidentUpdate $update)
public function __construct(User $user, IncidentUpdate $update)
{
$this->user = $user;
$this->update = $update;
}
@@ -48,4 +59,17 @@ final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterfac
{
return 'Incident Update was removed.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}