<?php
 namespace Modules\Admin\Cities; class Model extends \App\Mvc\Model_ListingAbstract { public function list_execute(\App\Mvc\View\Listing\Members\Params $listingParams) { $filters = $listingParams->getFilters(); $listObj = new \App\EntityList\Cities(); $listObj->setColumns(['name', 'name2', 'code3', 'codeLocal', 'region', 'region2', 'district', 'district2', 'addTime', 'countryCode']); if ($filters['name']) { $listObj->setCustomFilter('name LIKE ? OR name2 LIKE ?', ["%{$filters['name']}%", "%{$filters['name']}%"]); } if ($filters['code3']) { $listObj->setCustomFilter('code3 LIKE ? OR codeLocal LIKE ?', ["{$filters['code3']}", "{$filters['code3']}"]); } if ($filters['countryCode']['id']) { $listObj->setFilter('countryCode', '=', $filters['countryCode']['id']); } if ($filters['region']) { $listObj->setCustomFilter('region LIKE ? OR region2 LIKE ?', ["{$filters['region']}%", "{$filters['region']}%"]); } if ($filters['district']) { $listObj->setCustomFilter('district LIKE ? OR district2 LIKE ?', ["{$filters['district']}%", "{$filters['district']}%"]); } if ($filters['idCity']) { $listObj->setFilter('id', '=', $filters['idCity']); } $listObj = $this->entityList_inheritListingParams($listingParams, $listObj); $this->recordsList = $listObj->exportRecords(); $this->totalRecordsCount = $listObj->getRecordsCount(); } } 