Size: a a a

2020 October 15

В

Виктор in Yii Framework 3
Виктор
Получается, после мержа того PR этот кейс можно не рассматривать?
Да, добавлю, когда ответ вот на этот вопрос туда засуну)
источник

В

Виктор in Yii Framework 3
чтобы темы не разбивать
источник

AM

Alexander Makarov in Yii Framework 3
Виктор
Получается, после мержа того PR этот кейс можно не рассматривать?
Ну +-.
источник

AM

Alexander Makarov in Yii Framework 3
Сериализовать может не только оно.
источник

В

Виктор in Yii Framework 3
А можешь тогда объяснить, каким образом объект попадет в сериализатор, не будучи сконфигурированным в контейнере? Таки до вызова $container->get() его еще не существует, это только definition.
источник

T

TradersVE in Yii Framework 3
источник

AM

Alexander Makarov in Yii Framework 3
Thanks. Need to think about it. Useful.
источник

T

TradersVE in Yii Framework 3
Alexander Makarov
Thanks. Need to think about it. Useful.
👍
источник

В

Виктор in Yii Framework 3
How many people - so many opinions. There are lots of different things called "events", i.e.:
- some kind of immutable events: if a leaf has fallen from a tree, you can't get it back anymore. Frank de Jonge means these ones.
- some kind of proposal-events: "Hey, listeners, I want to persist these changes to the DB, if someone is against, then speak now or be silent forever". If any listener is against this proposition, the data shouldn't be persisted (return false from beforeSave in Yii2 ActiveRecord).
- I'm working on the library for event-driven programming. In fact there are events that trigger another events, that trigger another events... These events are immutable and they may be asynchronous. Despite the fact that I've named them "actions" (to avoid ambiguity increase), they are events by their essence.

In my opinion you should use the tool if it suites your needs instead of invent limitations where they don't exist.
источник

СП

Сергей Предводителев... in Yii Framework 3
Виктор
How many people - so many opinions. There are lots of different things called "events", i.e.:
- some kind of immutable events: if a leaf has fallen from a tree, you can't get it back anymore. Frank de Jonge means these ones.
- some kind of proposal-events: "Hey, listeners, I want to persist these changes to the DB, if someone is against, then speak now or be silent forever". If any listener is against this proposition, the data shouldn't be persisted (return false from beforeSave in Yii2 ActiveRecord).
- I'm working on the library for event-driven programming. In fact there are events that trigger another events, that trigger another events... These events are immutable and they may be asynchronous. Despite the fact that I've named them "actions" (to avoid ambiguity increase), they are events by their essence.

In my opinion you should use the tool if it suites your needs instead of invent limitations where they don't exist.
How do I work with such events in the app? Should be two eventdispatcher: for immutable events and for proposal-events?
источник

В

Виктор in Yii Framework 3
Сергей Предводителев
How do I work with such events in the app? Should be two eventdispatcher: for immutable events and for proposal-events?
I think it's responsibility of an event, not a dispatcher. Event dispatching it the same for the both types of events. But an event can be mutable or not.
источник

СП

Сергей Предводителев... in Yii Framework 3
Виктор
I think it's responsibility of an event, not a dispatcher. Event dispatching it the same for the both types of events. But an event can be mutable or not.
Bad subscriber can create modified event by immutable event and return him
источник

В

Виктор in Yii Framework 3
Сергей Предводителев
Bad subscriber can create modified event by immutable event and return him
Yes, if event is passed by reference to such a listener, it can be replaced. This is bad in my opinion.
источник

В

Виктор in Yii Framework 3
But it is limitation of php itself
источник

В

Виктор in Yii Framework 3
we can't avoid it
источник

СП

Сергей Предводителев... in Yii Framework 3
Why?

Dispatcher which send all subscribers immutable event.
источник

В

Виктор in Yii Framework 3
For now PSR-14 allows to return changed event from dispatch method.
источник

СП

Сергей Предводителев... in Yii Framework 3
Виктор
For now PSR-14 allows to return changed event from dispatch method.
yes) this is limit PSR-14, not PHP
источник

В

Виктор in Yii Framework 3
Сергей Предводителев
Why?

Dispatcher which send all subscribers immutable event.
fn (&$event) => $event = new AnotherEvent();
источник

СП

Сергей Предводителев... in Yii Framework 3
final class Dispatcher implements EventDispatcherInterface
{
   private ListenerProviderInterface $listenerProvider;

   public function __construct(ListenerProviderInterface $listenerProvider)
   {
       $this->listenerProvider = $listenerProvider;
   }

   public function dispatch(object $event): object
   {
       foreach ($this->listenerProvider->getListenersForEvent($event) as $listener) {
     $listener(clone $event);
       }
       return $event;
   }
}
источник