Use Interface
mathieutu opened this issue · comments
Mathieu TUDISCO commented
IMO, a better way to do that is to implement an interface on your models.
So your models implements interface should have some methods, which are provided by your trait.
Mathieu TUDISCO commented
So your method could be like that if your interface is called IsStoreInterface
(name to find):
/**
* Create a new event instance.
*
* @param IsStoreInterface $model
* @param $mutation
* @throws \Exception
*/
public function __construct(IsStoreInterface $model, $mutation)
{
$this->model = $model;
$this->store = $model->getStore();
$this->mutation = $mutation;
}
Anael FAVRE commented
Don't you think adding a trait and interface looks overkill ? It is just for one method getStore
:/