Trigger the beforeFind event on the query's repository object.

Will not trigger more than once, and only for select queries.

@return void
518123
public function triggerBeforeFind()
    {
        if (!$this->_beforeFindFired && $this->action() === self::ACTION_READ) {
            $endpoint = $this->getRepository();
            $this->_beforeFindFired = true;
            $endpoint->dispatchEvent('Model.beforeFind', [
                $this,
                new ArrayObject($this->_options),
                !$this->isEagerLoaded()
            ]);
        }
    }
1085221
public function beforeFind(Event $event)
    {
        //Inject default query handlers
        $queryParameters = Hash::merge($this->getConfig('queryParameters'), [
            'sort' => [
                'callable' => [$this, '_sortParameter'],
            ],
            'include' => [
                'callable' => [$this, '_includeParameter']
            ],
            'fields' => [
                'callable' => [$this, '_fieldSetsParameter']
            ]
        ]);

        foreach ($queryParameters as $parameter => $options) {
            if (is_callable($options)) {
                $options = [
                    'callable' => $options
                ];
            }

            if (!is_callable($options['callable'])) {
                throw new \InvalidArgumentException('Invalid callable supplied for query parameter ' . $parameter);
            }

            $options['callable']($this->_request()->getQuery($parameter), $event->getSubject(), $options);
        }
    }
1351128
public function afterFind()
    {
        parent::afterFind();
        $this->_oldTags = $this->tags;
        $this->_oldAuthors = ArrayHelper::getColumn(PostAuthor::find()->where(['post_id' => $this->id])->all(), 'author_id');
        $this->authors = $this->_oldAuthors;
    }
741690
public function onBeforeWrite()
    {
        /** @var string $currentLocale */
        $currentLocale = FluentState::singleton()->getLocale();
        if (!$currentLocale) {
            return;
        }

        // If the record is not versioned, force change
        if (!$this->owner->hasExtension(FluentVersionedExtension::class)) {
            $this->owner->forceChange();
            return;
        }

        // Force a change if the record doesn't already exist in the current locale
        if (!$this->owner->existsInLocale($currentLocale)) {
            $this->owner->forceChange();
        }
    }
831046
public function runPreSearch()
    {
        $needles = $this->preSearch;
        foreach ($needles as $needle) {
            if (strpos($this->value, $needle) !== false) {
                return true;
            }
        }

        return false;
    }
551904
protected function before_validate() {
        if (($this->get('id') && $this->get('sortorder') === null) || !$this->get('id')) {
            $this->set('sortorder', $this->count_records(array('courseid' => $this->get('courseid'))));
        }
    }
1012845
public function beforeValidate()
    {
        if ($this->owner->getIsNewRecord()) {
            // added new record always on top
            $this->owner->{$this->sortAttribute} = $this->owner->find()->andWhere($this->getCondition())->count();
        } else {
            // prevent direct change of sort field
            $this->owner->{$this->sortAttribute} = $this->owner->getOldAttribute($this->sortAttribute);
        }
    }
562535
protected function before_validate() {
        $this->beforeupdate = null;

        // During update.
        if ($this->get('id')) {
            $this->beforeupdate = new self($this->get('id'));
        }
    }
1075275
public function onBefore(BeforeEvent $event)
    {
        $request = $event->getRequest();

        if (!$this->canCacheRequest($request)) {
            $this->cacheMiss($request);
            return;
        }

        if (!($response = $this->storage->fetch($request))) {
            $this->cacheMiss($request);
            return;
        }

        $response->setHeader('Age', Utils::getResponseAge($response));
        $valid = $this->validate($request, $response);

        // Validate that the response satisfies the request
        if ($valid) {
            $request->getConfig()->set('cache_lookup', 'HIT');
            $request->getConfig()->set('cache_hit', true);
            $event->intercept($response);
        } else {
            $this->cacheMiss($request);
        }
    }
591698
public function before()
    {

        // ~ Init timer
        $this->time = - microtime(true);

        // ~ Reporting all error (default: all error) !
        error_reporting((int) $this->argument->get('error-reporting', null, - 1));
        ini_set('display_errors', (bool) $this->argument->get('error-display', null, 1));

        // ~ Set limit time to 0 (default: unlimited) !
        set_time_limit((int) $this->argument->get('time-limit', null, 0));

        $this->isVerbose = ! $this->argument->has('quiet');
    }
275782
public function beforeDelete()
    {
        foreach ($this->attributes as $attr => $options) {
            $this->ensureAttributes($attr, $options);
            $this->deleteFiles($attr);
        }
    }
974010
public function beforeFind(Event $event, Query $query, ArrayObject $options)
    {
        if (!$query->clause('order')) {
            $query->order([$this->_table->aliasField($this->_config['order']) => 'ASC']);
        }
    }
712223
public function beforeHook() : void
    {
        $commentChar = $this->repository->getConfigOperator()->getSafely('core.commentchar', '#');
        $commitMsg   = Git\CommitMessage::createFromFile($this->arguments->get('file', ''), $commentChar);

        $this->repository->setCommitMsg($commitMsg);

        parent::beforeHook();
    }
61474
public function afterFind()
    {
        parent::afterFind();
        $this->username_is_temporary = boolval($this->username_is_temporary);
        $this->is_active = boolval($this->is_active);
    }
875541
protected function beforeDelete() {

		// deletes user sessions
		$this->db->exec('DELETE FROM `sessions` WHERE id_user = ?', $this->id);
	
		// deletes error_logs of this user
		$this->db->exec('DELETE FROM `error_logs` WHERE user_id = ?', $this->id);
		
	}
465168
public function beforeDelete()
    {
        if (($url = UrlRule::findOne(['route' => '/system/page/view', 'params' => 'id=' . $this->id])) != null) {
            $url->delete();
        }
        parent::beforeDelete();
    }
822614
public function onBeforeWrite()
    {
        parent::onBeforeWrite();
        if ($this->UrlSegment) {
            $this->UrlSegment = Convert::raw2url($this->UrlSegment);
        } else {
            $this->UrlSegment = Convert::raw2url($this->ClassName.'-'.$this->ID);
        }
    }