Overload Model's method [load] to avoid duplicate call of load at ajaxValidation and common case
@param $data
@param null $formName
@return bool
499185
public function load($data, $formName = null)
    {
        return $this->_isDataLoaded ?: $this->_isDataLoaded=true && parent::load($data, $formName);
    }
240170
public function validate($name, $data, $format = null)
    {
        if (!is_string($data) && !is_array($data)) {
            throw new Exception("propriedade [ {$name} ] é inválida para tipo [ json ] definido no schema", 400);
        }

        $data = $this->encode($name, $data);

        if ($format) {
            $data = self::applyFormat($format, $data);
        }

        return (string)$data;
    }
1367679
protected function &loadFilterData(&$data) {

        if ( empty($this->filterMap) ) {
            return $data;
        }
        $error = null;
        $data = Filter::loadFromModel($data, $this->filterMap, $error);

        if ( $data == false ) {
            WebApplication::getInstance()->getAppError()->setCode(1);
            WebApplication::getInstance()->getAppError()->setMessage($error);
        }
        return $data;
    }
1213855
public function validate(array $data = null)
    {
        $data = $data ?: $this->getInput();

        $this->validation = $this->validator->make($data, $this->rules(), $this->messages());

        if ($this->validation->fails())
        {
            $this->failed();

            return false;
        }

        return true;
    }
586457
public function saveTranslation($language, $data, $formName = null) {
        $model = $this->getTranslationModel($language);
        $model->load($data, $formName);
        $dirty = $model->getDirtyAttributes();
       
        if (empty($dirty)) {
            return true; // we do not need to save anything
        }

        /** @var \yii\db\ActiveQuery $relation */
        $relation = $this->owner->getRelation($this->relation);

        $model->{key($relation->link)} = $this->owner->getPrimaryKey();
//        $result = $model->save();
//        if (!$result) {
//            Yii::info(\yii\helpers\VarDumper::dumpAsString($model->getErrors()));
//        }
//        return $result;
        return $model->save();
    }
1369664
public function loadWithTranslations($data, $languages, $formName = null, $translationFormName = null)
    {
        if ($this->owner->load($data, $formName)) {
            if (!$languages) {
                throw new InvalidParamException('Languages must be set.');
            }
            foreach ($languages as $language) {
                $modelI18n = static::getTranslation($language);
                $modelI18n->load($data, $translationFormName);
            }
            return true;
        }
        return false;
    }
652532
public function deleteTranslation(
        TranslationDeleteData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: sprintf('delete-translations');

        return $this->formFactory->createNamed($name, TranslationDeleteType::class, $data);
    }
777028
public function onFlash($eventName, array $data)
    {
        $this->validateEventData($data);

        list($notification, $notificationBag, $message) = $data;

        $key = implode('.', [$this->key, $notificationBag->getName()]);

        $this->session->push($key, $message);

        return true;
    }
430907
public function reset($formName = false)
    {
        if (is_bool($formName))
            $formName = $this->currentFormName;

        if (array_key_exists($formName, $this->validationRules)) {
            $this->validationRules[$formName] = [];
        }
    }
279547
protected function doUploadMultiple($form_name = 'img', $data = [])
    {
        $this->imageFiles = UploadedFile::getInstancesByName($form_name);
        $quality = self::getQualitySetting(50, $data);
        if ($this->imageFiles) {
            $url = [];
            foreach ($this->imageFiles as $file) {
                $model = new UploadImgForm();
                $model->imageFile = $file;
                $fileName = date('Y/m/d') . '/' . date('his') . '-' . $model->imageFile->baseName. '.' . $model->imageFile->extension;
                $fileName_save = self::getFileNameSave($fileName);
                $model->imageFile->saveAs($fileName_save);
                Image::getImagine()->open($fileName_save)->save($fileName_save, ['quality' => $quality]);
                self::generateThumbnail($fileName, $data);
                $url[] = 'uploads/' . $fileName;
                self::createNewMedia($fileName, $fileName_save, 'uploads/' . $fileName, $data);
            }
            return $url;
        } else {
            return null;
        }
    }
1218355
public function search($params, $formName = null)
    {
        $query = DpAdminMenuUrlRule::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params, $formName);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'rule_id' => $this->rule_id,
            'url_id' => $this->url_id,
            'status' => $this->status,
        ]);

        $query->andFilterWhere(['like', 'param_name', $this->param_name])
            ->andFilterWhere(['like', 'rule', $this->rule])
            ->andFilterWhere(['like', 'note', $this->note]);

        return $dataProvider;
    }
660410
public function execute($data = null)
    {
        $this->controller->setResponse(new HtmlResponse(
            '',
            $data->response->getStatusCode(),
            $data->response->getHeaders()
        ));

        $result = $this->next->execute($data);

        $this->controller->setRedirect(null);

        return $result;
    }
1300944
public function process($formdata, $data = null)
    {
        parent::process($formdata, $data);
        $this->current_token = $this->csrf_impl->generateCSRFToken($this);
    }
351745
static public function token($name=null, $data=null)
    {
        if (!is_null($name) && is_null($data) && (is_numeric($name) || is_array($name) || $name=='')) {
            $data = $name;
            $name = null;
        }
        
        return (new FormToken())->form($name, $data);
    }
1209914
protected function _trigger($eventName, Subject $data = null)
    {
        return $this->_crud()->trigger($eventName, $data);
    }
311083
public function ValidateData($sFormDataName = null)
    {
        if (is_null($sFormDataName)) {
            $sFormDataName = TdbDataExtranetUser::MSG_FORM_FIELD;
        }
        $bIsValid = parent::ValidateData($sFormDataName);
        $oMsgManager = TCMSMessageManager::GetInstance();

        // check postal code for country
        $bHasCountry = (array_key_exists('data_country_id', $this->sqlData) && !empty($this->sqlData['data_country_id']));
        $bHasPostalcode = (array_key_exists('postalcode', $this->sqlData) && !empty($this->sqlData['postalcode']));
        if ($bHasCountry && $bHasPostalcode) {
            $oCountry = TdbDataCountry::GetNewInstance();
            /** @var $oCountry TdbDataCountry */
            if ($oCountry->Load($this->sqlData['data_country_id'])) {
                if (!$oCountry->IsValidPostalcode($this->sqlData['postalcode'])) {
                    $oMsgManager->AddMessage($sFormDataName.'-postalcode', 'ERROR-USER-FIELD-INVALID-POSTALCODE');
                    $bIsValid = false;
                }
            }
        }

        return $bIsValid;
    }
344707
public static function validateByCallback($paramName, array $data,
                                              array $params)
    {
        if (isset($params['callback'])) {
            return $params['callback']($paramName, $data);
        } else {
            throw new \Exception('Callback parameter is required');
        }
    }