portal.mkgtu.ru/common/modules/abiturient/validators/extenders/ParentAddressData/ParentAddressDataValidation...

19 lines
603 B
PHP
Raw Normal View History

2024-03-28 09:51:45 +03:00
<?php
namespace common\modules\abiturient\validators\extenders\ParentAddressData;
use common\models\settings\ParentDataSetting;
use common\modules\abiturient\models\AddressData;
use common\modules\abiturient\validators\extenders\BaseValidationExtender;
class ParentAddressDataValidation extends BaseValidationExtender
{
public function modelPreparationCallback()
{
$setting = ParentDataSetting::findOne(['name' => 'require_parent_address_data']);
if ($setting && !$setting->value) {
$this->model->setScenario(AddressData::SCENARIO_NOT_REQUIRED);
}
}
}