-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add event action storage. Closes #2344
- Loading branch information
Showing
92 changed files
with
1,512 additions
and
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Events; | ||
|
||
/** | ||
* This is the action interface. | ||
* | ||
* @author Graham Campbell <[email protected]> | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
interface ActionInterface | ||
{ | ||
/** | ||
* Get the event action. | ||
* | ||
* @return array | ||
*/ | ||
public function getAction(); | ||
} |
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 |
---|---|---|
|
@@ -13,6 +13,12 @@ | |
|
||
use CachetHQ\Cachet\Bus\Events\EventInterface; | ||
|
||
/** | ||
* This is the component event interface. | ||
* | ||
* @author Graham Campbell <[email protected]> | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
interface ComponentEventInterface extends EventInterface | ||
{ | ||
// | ||
|
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 |
---|---|---|
|
@@ -11,15 +11,24 @@ | |
|
||
namespace CachetHQ\Cachet\Bus\Events\Component; | ||
|
||
use CachetHQ\Cachet\Bus\Events\ActionInterface; | ||
use CachetHQ\Cachet\Models\Component; | ||
use CachetHQ\Cachet\Models\User; | ||
|
||
/** | ||
* This is the component status was updated event. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
final class ComponentStatusWasUpdatedEvent implements ComponentEventInterface | ||
final class ComponentStatusWasUpdatedEvent implements ActionInterface, ComponentEventInterface | ||
{ | ||
/** | ||
* The user who updated the component. | ||
* | ||
* @var \CachetHQ\Cachet\Models\User | ||
*/ | ||
public $user; | ||
|
||
/** | ||
* The component that was updated. | ||
* | ||
|
@@ -44,14 +53,16 @@ final class ComponentStatusWasUpdatedEvent implements ComponentEventInterface | |
/** | ||
* Create a new component was updated event instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\User $user | ||
* @param \CachetHQ\Cachet\Models\Component $component | ||
* @param int $original_status | ||
* @param int $new_status | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Component $component, $original_status, $new_status) | ||
public function __construct(User $user, Component $component, $original_status, $new_status) | ||
{ | ||
$this->user = $user; | ||
$this->component = $component; | ||
$this->original_status = $original_status; | ||
$this->new_status = $new_status; | ||
|
@@ -66,4 +77,17 @@ public function __toString() | |
{ | ||
return 'Component status was updated.'; | ||
} | ||
|
||
/** | ||
* Get the event action. | ||
* | ||
* @return array | ||
*/ | ||
public function getAction() | ||
{ | ||
return [ | ||
'user' => $this->user, | ||
'description' => (string) $this, | ||
]; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -11,10 +11,24 @@ | |
|
||
namespace CachetHQ\Cachet\Bus\Events\Component; | ||
|
||
use CachetHQ\Cachet\Bus\Events\ActionInterface; | ||
use CachetHQ\Cachet\Models\Component; | ||
use CachetHQ\Cachet\Models\User; | ||
|
||
final class ComponentWasRemovedEvent implements ComponentEventInterface | ||
/** | ||
* This is the component was removed event class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
final class ComponentWasRemovedEvent implements ActionInterface, ComponentEventInterface | ||
{ | ||
/** | ||
* The user who removed the component. | ||
* | ||
* @var \CachetHQ\Cachet\Models\User | ||
*/ | ||
public $user; | ||
|
||
/** | ||
* The component that was removed. | ||
* | ||
|
@@ -25,12 +39,14 @@ final class ComponentWasRemovedEvent implements ComponentEventInterface | |
/** | ||
* Create a new component was removed event instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\User $user | ||
* @param \CachetHQ\Cachet\Models\Component $component | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Component $component) | ||
public function __construct(User $user, Component $component) | ||
{ | ||
$this->user = $user; | ||
$this->component = $component; | ||
} | ||
|
||
|
@@ -43,4 +59,17 @@ public function __toString() | |
{ | ||
return 'Component was removed.'; | ||
} | ||
|
||
/** | ||
* Get the event action. | ||
* | ||
* @return array | ||
*/ | ||
public function getAction() | ||
{ | ||
return [ | ||
'user' => $this->user, | ||
'description' => (string) $this, | ||
]; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -11,16 +11,25 @@ | |
|
||
namespace CachetHQ\Cachet\Bus\Events\Component; | ||
|
||
use CachetHQ\Cachet\Bus\Events\ActionInterface; | ||
use CachetHQ\Cachet\Models\Component; | ||
use CachetHQ\Cachet\Models\User; | ||
|
||
/** | ||
* This is the component was updated event class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
* @author Graham Campbell <[email protected]> | ||
*/ | ||
final class ComponentWasUpdatedEvent implements ComponentEventInterface | ||
final class ComponentWasUpdatedEvent implements ActionInterface, ComponentEventInterface | ||
{ | ||
/** | ||
* The user who updated the component. | ||
* | ||
* @var \CachetHQ\Cachet\Models\User | ||
*/ | ||
public $user; | ||
|
||
/** | ||
* The component that was updated. | ||
* | ||
|
@@ -31,12 +40,14 @@ final class ComponentWasUpdatedEvent implements ComponentEventInterface | |
/** | ||
* Create a new component was updated event instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\User $user | ||
* @param \CachetHQ\Cachet\Models\Component $component | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Component $component) | ||
public function __construct(User $user, Component $component) | ||
{ | ||
$this->user = $user; | ||
$this->component = $component; | ||
} | ||
|
||
|
@@ -49,4 +60,17 @@ public function __toString() | |
{ | ||
return 'Component was updated.'; | ||
} | ||
|
||
/** | ||
* Get the event action. | ||
* | ||
* @return array | ||
*/ | ||
public function getAction() | ||
{ | ||
return [ | ||
'user' => $this->user, | ||
'description' => (string) $this, | ||
]; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -13,6 +13,12 @@ | |
|
||
use CachetHQ\Cachet\Bus\Events\EventInterface; | ||
|
||
/** | ||
* This is the component group event interface. | ||
* | ||
* @author Graham Campbell <[email protected]> | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
interface ComponentGroupEventInterface extends EventInterface | ||
{ | ||
// | ||
|
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
Oops, something went wrong.