andersao / andersao/l5-repository

Events: suggestion

Offen
#379 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
4.2k
Forks
880
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi,

Events are not described in docs, but from what I see the package fires 3 events:

```
RepositoryEntityCreated
RepositoryEntityDeleted
RepositoryEntityUpdated
```

That is not very comfortable because 1 Listener will listen to all created/deleted/updated events on all the Repositories. Is there a way to specify those events the same way Eloquent Model does:

```
/**
* The event map for the model.
*
* @var array
*/
protected $events = [
'saved' => UserSaved::class,
'deleted' => UserDeleted::class,
];
```

It is more comfortable way as for me, but at the same time it looks a bit like repeating stuff from Eloquent Model. Then is there any sense in including events to the package at all? From the other hand if I use events from Eloquent Model while using l5-repositories then I am losing some kind of abstraction. Sorry If I missed something and thank you for this great package.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.