<?php
 namespace Modules\Partners\Customers\FrequentBuyerCards; 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\FrequentBuyerCards(); $listObj->setColumns([ 'frequentBuyerCards.cardNumber', 'frequentBuyerCards.idCustomer', 'frequentBuyerCards.addTime', 'frequentBuyerCards.idAddUser', 'frequentBuyerCards.lastUpdateTime', 'frequentBuyerCards.idUpdateUser', ]); $listObj->setCustomColumn("GROUP_CONCAT(DISTINCT suppliers.`idSupplier` ORDER BY suppliers.`idSupplier` SEPARATOR '|')", "suppliers", "suppliers"); $listObj->setGroupBy('frequentBuyerCards.id'); if ($filters['cardNumber'] && strlen($filters['cardNumber'])) { $listObj->setFilter("frequentBuyerCards.`cardNumber`", "LIKE", "%{$filters['cardNumber']}%"); } if($filters['idCustomer']['id']) { $listObj->setFilter("frequentBuyerCards.`idCustomer`", "=", $filters['idCustomer']['id']); } if ($filters['idSupplier']['id']) { $listObj->setFilter("suppliers.`idSupplier`", "=", $filters['idSupplier']['id']); } $listObj = $this->entityList_inheritListingParams($listingParams, $listObj); $this->recordsList = $listObj->exportRecords(); $this->totalRecordsCount = $listObj->getRecordsCount(); } } 