public function actionGetAddressData()
{
- $params = Yii::$app->request->post()['depdrop_all_params'] ?? [];
+ $params = Yii::$app->request->post('depdrop_all_params', []);
if (isset($params['region'])) {
- $cities = StoreCityList::findAll(['parent_id' => $params['region'], 'type' => StoreCityList::TYPE_CITY]);
+ $cities = StoreCityList::findAll(['parent_id' => (int)$params['region'], 'type' => StoreCityList::TYPE_CITY]);
if (!empty($cities)) {
$cityList = array_map(fn($city) => ['id' => $city->id, 'name' => $city->name], $cities);
}
if (isset($params['city'])) {
- $districts = StoreCityList::findAll(['parent_id' => $params['city'], 'type' => StoreCityList::TYPE_DISTRICT]);
+ $districts = StoreCityList::findAll(['parent_id' => (int)$params['city'], 'type' => StoreCityList::TYPE_DISTRICT]);
if (!empty($districts)) {
$districtList = array_map(fn($district) => ['id' => $district->id, 'name' => $district->name], $districts);