Evaluates the attribute value and assigns it to the current attributes.
@param Event $event
172118
public function evaluateAttributes($event)
    {
        if (!empty($this->attributes[$event->name])) {
            $attributes = (array) $this->attributes[$event->name];
            foreach ($attributes as $attribute) {
                // ignore attribute names which are not string (e.g. when set by TimestampBehavior::updatedAtAttribute)
                if (is_string($attribute)) {
                    $value = $this->getValue($event, $attribute);
                    $this->owner->$attribute = $value;
                }
            }
        }
    }
564525
protected function handle(Event $event): void
    {
        $method = 'apply'.ClassName::short($event);

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

        $this->$method($event);
    }
965850
public function prepareApiAttributes(Serializing $event)
    {
        if ($event->isSerializer(ForumSerializer::class)) {
            $event->attributes['canUpload'] = $event->actor->can('flagrow.upload');
            $event->attributes['canDownload'] = $event->actor->can('flagrow.upload.download');
        }
    }
1015274
protected function create(Event $event)
    {
        $this->dispatch(static::EVENT_CREATE_BEFORE, $event);
        if (!$event->isPropagationStopped()) {
            $this->createProcess($event);
            if (!$event->isPropagationStopped()) {
                $this->dispatch(static::EVENT_CREATE_AFTER, $event);
            }
        }
    }
587333
public static function configureProject(Event $event)
    {
        DirectoryConfigurator::fromEvent($event)->run();
        BundleConfigurator::fromEvent($event)->run();

        // Install assets here since they they were skipped above
        static::installAssets($event, false);
    }
1290323
public function afterFind($event)
    {
        $this->_dbAttributes = $this->owner->getAttributes();
        parent::afterFind($event);
    }
1117977
public function update($event, $value)
    {
        if (null === $value) {
            return;
        }

        $event->setHtml($value);
        $event->stopPropagation();
    }
868480
protected function update(Event $event)
    {
        $this->dispatch(static::EVENT_UPDATE_BEFORE, $event);
        if (!$event->isPropagationStopped()) {
            $this->updateProcess($event);
            if (!$event->isPropagationStopped()) {
                $this->dispatch(static::EVENT_UPDATE_AFTER, $event);
            }
        }
    }
921565
public function afterPaginate(Event $event)
    {
        $event;
        if (!$this->_table()->behaviors()->has('Search')) {
            return;
        }

        $enabled = $this->getConfig('enabled') ?: !$this->_request()->is('api');
        if (!$enabled) {
            return;
        }

        $fields = $this->fields();
        $this->_controller()->set('searchInputs', $fields);
    }
955190
protected function execute($event)
    {
        foreach($this->events[$event] as $handler) {
            $this->listen($event, $handler);
        }
    }
1163815
public function setLanguage(Event $event)
    {
        /**
         * @var $app Application
         */
        $app = $event->data;
        foreach ($this->handlers as $handler) {
            $intersection = array_intersect($this->languages, $handler->getLanguages());
            if (!empty($intersection)) {
                Yii::$app->language = current($intersection);
                break;
            }
        }
        $app->trigger(self::EVENT_AFTER_SETTING_LANGUAGE);
    }
141032
public function evaluateAttributes($event)
    {
        if (isset($this->attributes[$event->name])) {
            $enumList = $this->attributes[$event->name];
            if ($this->changeOriginal) {
                if ($event->name == ActiveRecord::EVENT_BEFORE_VALIDATE) {
                    foreach ($enumList as $attribute => $values) {
                        $this->enumData[$attribute . 'List'] = $values;
                        $this->enumData[$attribute . 'Name'] = $this->owner->$attribute;
                        $values = array_flip($values);
                        $valueName = isset($values[$this->owner->$attribute]) ? $values[$this->owner->$attribute] : $this->owner->$attribute;
                        $this->enumData[$attribute . 'Value'] = $valueName;
                        $this->owner->$attribute = $valueName;
                    }
                }
                if (in_array($event->name, [ActiveRecord::EVENT_AFTER_FIND, ActiveRecord::EVENT_AFTER_INSERT, ActiveRecord::EVENT_AFTER_UPDATE])) {
                    foreach ($enumList as $attribute => $values) {
                        $this->enumData[$attribute . 'List'] = $values;
                        $this->enumData[$attribute . 'Value'] = $this->owner->$attribute;
                        $valueName = isset($values[$this->owner->$attribute]) ? $values[$this->owner->$attribute] : $this->owner->$attribute;
                        $this->enumData[$attribute . 'Name'] = $valueName;
                        $this->owner->$attribute = $valueName;
                    }
                }
            } else {
                if ($event->name == ActiveRecord::EVENT_AFTER_FIND) {
                    foreach ($enumList as $attribute => $values) {
                        $this->enumData[$attribute . 'List'] = $values;
                        $this->enumData[$attribute . 'Value'] = $this->owner->$attribute;
                        $valueName = isset($values[$this->owner->$attribute]) ? $values[$this->owner->$attribute] : $this->owner->$attribute;
                        $this->enumData[$attribute . 'Name'] = $valueName;
                    }
                }
            }
        }
    }
422595
public function update($event, $value)
    {
        if (null === $value) {
            return;
        }

        $event->setValue($value);
        $event->stopPropagation();
    }
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;
    }
  }
284432
public function addAttribute($attribute, $value)
    {
        $this->attributes[$attribute] = (string) $value;
        $this->eventHandler->attributeAdded($this, $attribute, $value);
    }
866846
public function setFlash(Event $event)
    {
        unset($event->getSubject()->params['class']);
        $event->getSubject()->element = ltrim($event->getSubject()->type);
    }
856448
public function afterSave($event)
    {
        if (!$this->enableAuditField) {
            parent::afterSave($event);
            return;
        }

        $date = time();
        $newAttributes = $this->owner->attributes;
        $oldAttributes = $this->_dbAttributes;
        $auditModels = $this->getAuditModels();
        $auditRequestId = $this->getAuditRequestId();
        $auditFields = array();
        $userId = Yii::app()->user && Yii::app()->user->id ? Yii::app()->user->id : 0;

        // insert
        if ($this->owner->isNewRecord) {
            foreach ($newAttributes as $name => $new) {
                if (in_array($name, $this->ignoreFields['insert'])) continue;

                // prepare the values
                $new = trim($new);
                if (!$new) continue;

                // prepare the logs
                foreach ($auditModels as $auditModel) {
                    if (isset($auditModel['ignoreFields']) && in_array($name, $auditModel['ignoreFields'])) continue;
                    $auditFields[] = array(
                        'old_value' => '',
                        'new_value' => $new,
                        'action' => 'INSERT',
                        'model_name' => $auditModel['model_name'],
                        'model_id' => $auditModel['model_id'],
                        'field' => $auditModel['prefix'] . $name,
                        'created' => $date,
                        'user_id' => $userId,
                        'audit_request_id' => $auditRequestId,
                    );
                }
            }
        }

        // update
        else {
            // compare old and new
            foreach ($newAttributes as $name => $new) {
                if (in_array($name, $this->ignoreFields['update'])) continue;

                // prepare the values
                $old = !empty($oldAttributes) ? trim($oldAttributes[$name]) : '';
                $new = trim($new);
                if (in_array($old, $this->ignoreValues)) $old = '';
                if (in_array($new, $this->ignoreValues)) $new = '';
                if ($new == $old) continue;

                // prepare the logs
                foreach ($auditModels as $auditModel) {
                    if (isset($auditModel['ignoreFields']) && in_array($name, $auditModel['ignoreFields'])) continue;
                    $auditFields[] = array(
                        'old_value' => $old,
                        'new_value' => $new,
                        'action' => 'UPDATE',
                        'model_name' => $auditModel['model_name'],
                        'model_id' => $auditModel['model_id'],
                        'field' => $auditModel['prefix'] . $name,
                        'created' => $date,
                        'user_id' => $userId,
                        'audit_request_id' => $auditRequestId,
                    );
                }
            }
        }

        // insert the audit_field records
        $this->addAuditFields($auditFields);

        // set the dbAttributes to the new values
        $this->_dbAttributes = $this->owner->attributes;

        parent::afterSave($event);
    }