spatie / laravel-event-sourcing

The easiest way to get started with event sourcing in Laravel
https://docs.spatie.be/laravel-event-sourcing
MIT License
768 stars 164 forks source link

Deprecation notice: $firedFromAggregateRoot is deprecated #435

Closed ahoiroman closed 6 months ago

ahoiroman commented 1 year ago

Using PHP 8.2, I am getting this deprecation notice, if I set 'dispatch_events_from_aggregate_roots' => true,:

DEPRECATED Creation of dynamic property ... $firedFromAggregateRoot is deprecated in vendor/spatie/laravel-event-sourcing/src/StoredEvents/StoredEvent.php on line 68.

Should be possible to allow dynamic props or define them?

sebastiandedeyne commented 10 months ago

Hmm I'm not sure we can do this without a breaking change, so might have to live with it until our next major version… The warning is annoying but everything still works until PHP 9 when dynamic properties will be removed entirely.

If anyone has an idea how we can work around this in a non-breaking way, ideas welcome!

inmanturbo commented 6 months ago

@sebastiandedeyne can this not be solved using an #[\AllowDynamicProperties] attribute?