Create an interface for all "changing entities" events

parent 0e903c71
<?php
namespace Modules\Core\Contracts;
interface EntityIsChanging
{
/**
* Get the attributes used to create or modify an entity
* @return array
*/
public function getAttributes();
/**
* Set the attributes used to create or modify an entity
* @param array $attributes
*/
public function setAttributes(array $attributes);
/**
* Get the original attributes untouched by other listeners
* @return array
*/
public function getOriginal();
}
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
namespace Modules\User\Events; namespace Modules\User\Events;
final class UserIsCreating use Modules\Core\Contracts\EntityIsChanging;
final class UserIsCreating implements EntityIsChanging
{ {
/** /**
* Contains the attributes which can be changed by other listeners * Contains the attributes which can be changed by other listeners
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
namespace Modules\User\Events; namespace Modules\User\Events;
use Modules\Core\Contracts\EntityIsChanging;
use Modules\User\Entities\UserInterface; use Modules\User\Entities\UserInterface;
class UserIsUpdating final class UserIsUpdating implements EntityIsChanging
{ {
/** /**
* @var UserInterface * @var UserInterface
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment