Get the created/updated/deleted-by column, or null if it is not used.

@param string $event One of (created|updated|deleted)

@return string|null
778703
public function getColumn(Model $model, $event)
    {
        if (!array_key_exists($event, $this->getBlameableFields($model))) {
            return;
        }

        $fields = $this->getBlameableFields($model);

        return $fields[$event];
    }
1327751
public function getEvent($event, $table = ':any')
    {
        if ($table instanceof Raw) {
            return null;
        }
        return isset($this->events[$table][$event]) ? $this->events[$table][$event] : null;
    }
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);
    }
946335
public function eventAfterDelete($event)
    {
        if ($this->isLoggable()) {
            Yii::$app->db->createCommand()->insert('{{%admin_ngrest_log}}', [
                'user_id' => $this->getUserId(),
                'timestamp_create' => time(),
                'route' => $this->route,
                'api' => $this->api,
                'is_insert' => false,
                'is_update' => false,
                'is_delete' => true,
                'attributes_json' => $this->toJson($event->sender->getAttributes()),
                'table_name' => $event->sender->tableName(),
                'pk_value' => implode("-", $event->sender->getPrimaryKey(true)),
            ])->execute();
        }
    }
202747
protected function ensureEvent($event): Event
    {
        if (Assert::instanceOf($event, '\\One\\Event\\Event')) {
            return $event;
        } elseif (Assert::string($event)) {
            return new Event($event);
        }

        throw new InvalidArgumentException(
            '`Event` must be `string` or extends class `One\Event\Event`'
        );
    }
393786
public function off($event)
    {
        if ($this->hasEvent($event)) {
            $handler = $this->eventHandlers[$event];

            unset($this->events[$event], $this->eventHandlers[$event]);

            return $handler;
        }

        return null;
    }
828381
public function beforeUpdate($event = null)
    {
        foreach (['child', 'parent'] as $role) {
            $primaryField = $this->getPrimaryField($role);
            $this->wasPrimary[$role] = !empty($this->owner->{$primaryField});
            if (!$this->owner->isActive) {
                $this->owner->{$primaryField} = 0;
            }
        }

        return true;
    }
2628
protected function getValue($event)
    {
        if ($this->value === null && Yii::getApp()->has('user')) {
            $userId = Yii::getApp()->get('user')->id;
            if ($userId === null) {
                return $this->getDefaultValue($event);
            }

            return $userId;
        }

        return parent::getValue($event);
    }
38437
public function col_time($event) {

        if (empty($this->download)) {
            $dateformat = get_string('strftimedatetime', 'core_langconfig');
        } else {
            $dateformat = get_string('strftimedatetimeshort', 'core_langconfig');
        }
        return userdate($event->timecreated, $dateformat);
    }
259026
protected function getPayloadFromEvent($event)
    {
        if (method_exists($event, 'broadcastWith')) {
            return array_merge(
                $event->broadcastWith(), ['socket' => data_get($event, 'socket')]
            );
        }

        $payload = [];

        foreach ((new ReflectionClass($event))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
            $payload[$property->getName()] = $this->formatProperty($property->getValue($event));
        }

        unset($payload['broadcastQueue']);

        return $payload;
    }
946338
public function getEventClassName(string $event)
    {
        if (isset(self::$eventsMap[$event])) {
            return self::$eventsMap[$event];
        }

        $listeners = $this->eventDispatcher->getListeners($event);
        if (empty($listeners)) {
            return null;
        }

        foreach ($listeners as $listener) {
            if (!\is_array($listener) || 2 !== \count($listener)) {
                continue;
            }

            $reflectionMethod = new \ReflectionMethod($listener[0], $listener[1]);
            $args = $reflectionMethod->getParameters();
            if (!$args) {
                continue;
            }

            if (null !== $type = $args[0]->getType()) {
                return (string) $type;
            }
        }

        return null;
    }
460029
public function dispatch(Event $event)
        {
            $message = sprintf(self::FMT_INF_DISPATCHING, $event->getId(), count($this->subscriptions));
            $this->logger->info($message);

            $dispatchCount = 0;

            foreach ($this->subscriptions as $subscription) {
                $result = $this->tryDispatch($subscription, $event);

                $dispatchCount += (int)$result;
            }

            $message = sprintf(self::FMT_INF_DISPATCHED, $event->getId(), $dispatchCount);
            $this->logger->info($message);

            return $dispatchCount;
        }
654823
public function getLastInsertedId($column = null)
    {
        if (is_string($column)) {
            return $this->getConnection()->lastInsertId($column);
        }

        return $this->getConnection()->lastInsertId();
    }
569079
public function getListeners($event = null)
	{
		$event = $this->resolveEventName($event);

		if ($event)
		{
			if (isset($this->listeners[$event]))
			{
				return $this->listeners[$event]->getAll();
			}
			return array();
		}

		return $this->listeners;
	}
195226
public function onDelete(Event\Delete $event)
    {
        $success = $event->getUser()->delete();
        $event->setResult( (bool)$success );
        if( $event->getResult() === false )
        {
            $event->stopPropagation(true);
        }
        return $event;
    }
1052364
public function onAddPasswordToHistory($event)
    {
        $password = $event->data;
        $sender = $event->sender;
        /* @var $sender static */
        if (empty($sender->passwordHistoryClass) ||
                !class_exists($sender->passwordHistoryClass) ||
                empty($sender->passwordHashAttribute) ||
                !is_string($sender->passwordHashAttribute)) {
            return false;
        }
        if (empty($password)) {
            $password = ['pass_hash' => $sender->{$sender->passwordHashAttribute}];
        }
        $class = $sender->passwordHistoryClass;
        if (array_key_exists('pass_hash', $password)) {
            return $class::addHash($password['pass_hash'], $sender);
        }
        if (array_key_exists('password', $password)) {
            return $class::add($password['password'], $sender);
        }
        return false;
    }
531968
public function beforeUpdate($event)
    {
        $fields = $this->fields;
        $nowDate = gmdate($this->databaseTimeFormat);
        if (!$this->isActuallyDirty()) {
            return;
        }

        if (isset($this->fields['modifiedField']) && !$this->owner->isAttributeChanged($this->fields['modifiedField'])) {
            $this->owner->{$this->fields['modifiedField']} = $nowDate;
        }
        if (isset($this->fields['modifiedByField']) && !$this->owner->isAttributeChanged($this->fields['modifiedByField'])) {
            $this->owner->{$this->fields['modifiedByField']} = self::_getUserId();
        }
    }