<?php
 namespace Modules\Admin\Offices; 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\Offices(); $listObj->setColumns(['name', 'iataCode', 'addTime', 'email', 'telephone', 'idAddUser', 'defaultOffice', 'countryCode', 'cityId', 'address']); if ($filters['text']) { $vars = [$filters['text'], $filters['text'].'%', '%,'.$filters['text'], '%'.$filters['text'].'%', $filters['text']]; $listObj->setCustomFilter('name LIKE ? OR name LIKE ? OR name LIKE ? OR name LIKE ? OR iataCode = ? ', $vars); } if ($filters['location']['id']) { $locationDetails = explode('|', $filters['location']['id']); $listObj->setFilter('countryCode', '=', $locationDetails[0]); $listObj->setFilter('cityId', '=', $locationDetails[1]); } $listObj = $this->entityList_inheritListingParams($listingParams, $listObj); $this->recordsList = $listObj->exportRecords(); $this->totalRecordsCount = $listObj->getRecordsCount(); } } 