Listen to ValueChangeEvents
@param $event ValueChangeEvent instance
503805
public function valueChanged(ValueChangeEvent $event) {
    $object = $event->getObject();
    $name = $event->getValueName();
    $initialOid = $object->getProperty(self::PROPERTY_INITIAL_OID);
    if (isset($this->observedObjects[$initialOid])) {
      $newValue = $event->getNewValue();
      // make a criteria from newValue and make sure that all properties are set
      if (!($newValue instanceof Criteria)) {
        // LIKE fallback, if the value is not a Criteria instance
        $mapper = self::getMapper($object->getType());
        $pkNames = $mapper->getPkNames();
        if (!in_array($name, $pkNames)) {
          // use like condition on any attribute, if it's a string
          // other value changes will be ignored!
          if (is_string($newValue)) {
            $newValue = new Criteria($object->getType(), $name, 'LIKE', '%'.$newValue.'%');
          }
        }
        else {
          // don't search for pk names with LIKE
          $newValue = new Criteria($object->getType(), $name, '=', $newValue);
        }
      }
      else {
        // make sure that type and name are set even if the Criteria is constructed
        // via Criteria::forValue()
        $newValue->setType($object->getType());
        $newValue->setAttribute($name);
      }

      $oid = $object->getOID()->__toString();
      // store change in internal array to have it when constructing the query
      if (!isset($this->conditions[$oid])) {
        $this->conditions[$oid] = [];
      }
      $this->conditions[$oid][$name] = $newValue;
    }
  }
92916
public function setEvent($event = [])
    {
        if (!empty($event['id'])) {
            $this->setLogs($event['id'], 'campaignEventId');
        }
        $overrides = [];
        if (!empty($event['config']['contactclient_overrides'])) {
            // Flatten overrides to key-value pairs.
            $jsonHelper = new JSONHelper();
            $array      = $jsonHelper->decodeArray($event['config']['contactclient_overrides'], 'Overrides');
            if ($array) {
                foreach ($array as $field) {
                    if (!empty($field->key) && !empty($field->value) && (empty($field->enabled) || true === $field->enabled)) {
                        $overrides[$field->key] = $field->value;
                    }
                }
            }
            if ($overrides) {
                $this->setOverrides($overrides);
            }
        }
        $this->event = $event;

        return $this;
    }
323694
@UiHandler("m_everyDay")
    void onEveryDayValueChange(ValueChangeEvent<String> event) {

        if (handleChange()) {
            m_controller.setDayOfMonth(event.getValue());
        }

    }
1010442
public function onReceivedAtChanged($event)
    {
        $sender = $event->sender;
        $raAttribute = $sender->receivedAtAttribute;
        if (!is_string($raAttribute) || empty($raAttribute)) {
            return;
        }
        // If it is permitted to change receiving time, then it will return directly.
        if ($sender->permitChangeReceivedAt) {
            return;
        }
        $oldRa = $sender->getOldAttribute($raAttribute);
        if ($oldRa != null && !$sender->isInitDatetime($oldRa) && $sender->$raAttribute != $oldRa) {
            $sender->$raAttribute = $oldRa;
        }
    }
576518
public function onBeforeValidate($event)
    {
        foreach ($this->attributeValues as $name => $value) {

            $options = ArrayHelper::merge([
                'class' => DateValidator::className(),
                'format' => $value->localFormat[1],
            ], $this->validatorOptions);

            $validator = Yii::createObject($options);
            $validator->validateAttributes($this->owner, [$value->localAttribute]);
        }
    }
85211
public function setEvent($event)
  {
    if ($event === '?' || $event === '') {
      $this->event = null;
    } else {
      $event = Util::foreignLettersToEnglishLetters($event);
      $event = Util::titleCaseIfCurrentlyAllCaps($event);
      $this->event = $event === '?' ? null : $event;
    }
  }
905392
public function trigger($event = null)
    {
        //argument 1 must be string
        Argument::i()->test(1, 'string', 'null');

        if (is_null($event)) {
            $trace = debug_backtrace();
            $event = $trace[1]['function'];
            if (isset($trace[1]['class']) && trim($trace[1]['class'])) {
                $event = str_replace('\\', '-', $trace[1]['class']).'-'.$event;
            }
        }

        //get the arguments
        $args = func_get_args();
        //shift out the event
        array_shift($args);

        //for each observer
        foreach ($this->observers as $observer) {
            //if this is the same event, call the method, if the method returns false
            if ($event == $observer[0] && call_user_func_array($observer[2], $args) === false) {
                //break out of the loop
                break;
            }
        }

        return $this;
    }
451556
public function listen($event, $listener){
        if (!$this->emitter){
            return $this;
        }
        $this->emitter->listen($event, $listener);
        return $this;
    }
49109
protected function handle($event): void
    {
        $method = $this->getApplyMethod($event);

        if (!method_exists($this, $method)) {
            return;
        }

        $this->$method($event);
    }
1164858
public function listen(Event $event)
    {
        // Plugin has been uninstalled
        if (!file_exists(__FILE__) || !file_exists(__DIR__.'/PuliPluginImpl.php')) {
            return;
        }

        // Load the implementation only after updating Composer so that we get
        // the new version of the plugin when a new one was installed
        if (null === $this->impl) {
            $this->impl = new PuliPluginImpl($event);
        }

        switch ($event->getName()) {
            case ScriptEvents::PRE_AUTOLOAD_DUMP:
                $this->impl->preAutoloadDump();
                break;
            case ScriptEvents::POST_AUTOLOAD_DUMP:
                $this->impl->postAutoloadDump();
                break;

            case ScriptEvents::POST_INSTALL_CMD:
            case ScriptEvents::POST_UPDATE_CMD:
                $this->impl->postInstall();
                break;
        }
    }
660707
@UiHandler("m_atDay")
    void onWeekDayChange(ValueChangeEvent<String> event) {

        if (handleChange()) {
            m_controller.setWeekDay(event.getValue());
        }
    }
782855
public function listen(ApplicationEvent $event) {
    if ($event->getStage() == ApplicationEvent::BEFORE_ROUTE_ACTION) {
      $request = $event->getRequest();
      if ($request != null) {
        $this->transformRequest($request);
      }
    }
    else if ($event->getStage() == ApplicationEvent::AFTER_EXECUTE_CONTROLLER) {
      $request = $event->getRequest();
      $response = $event->getResponse();
      if ($request != null && $response != null) {
        $this->transformResponse($request, $response);
      }
    }
  }
1330576
public function notify($event = null)
    {
        /* @var Doozr_Base_Crud_Interface $observer */
        foreach ($this->observer as $observer) {
            $observer->update($this, $event);
        }

        $this->clear();
    }
1153680
public function addValueChangedListener(ValueChangedListenerInterface $listener)
    {
        if (!$this->listeners->hasItem($listener)) {
            $this->listeners->push($listener);
        }
    }
1124601
public function listen($event, callable $handler)
    {
        if (empty($this->handlers[$event])) {
            $this->handlers[$event] = [];
        }

        $this->handlers[$event][] = $handler;
    }
186925
public function listen($event, \Closure $callback): void
    {
        // check if $event is a single string and set it as array with one item
        if (!Any::isArray($event)) {
            $event = [$event];
        }
        
        // each every one event in array
        foreach ($event as $item) {
            if (Any::isArray($this->runned) && array_key_exists($item, $this->runned)) {
                call_user_func_array($callback, $this->runned[$item]);
            }
        }
    }
684190
function byEvent($event)
    {
        if (! $this->has($event) ) {
            if ($event instanceof iEvent)
                $this->bind($event);
            else 
                throw new \Exception("Events ({$event}) not found.");
        }

        $event = ($event instanceof iEvent) ? $event->getName() : $event;
        /** @var iEvent $event */
        $event = $this->attached_events[$event];
        if ($this->meeter)
            // Use Same Meeter For Bind Events
            $event->setMeeter($this->meeter);

        return $event;
    }