Пример #1
0
 protected function beforeHandleAdvancedQuery($advQueryRecord, \GO\Base\Db\FindCriteria &$criteriaGroup, \GO\Base\Db\FindParams &$storeParams)
 {
     $storeParams->debugSql();
     switch ($advQueryRecord['field']) {
         case 'employees.name':
             $storeParams->join(\GO\Addressbook\Model\Contact::model()->tableName(), \GO\Base\Db\FindCriteria::newInstance()->addRawCondition('`t`.`id`', '`employees' . $advQueryRecord['id'] . '`.`company_id`'), 'employees' . $advQueryRecord['id']);
             $criteriaGroup->addRawCondition('CONCAT_WS(\' \',`employees' . $advQueryRecord['id'] . '`.`first_name`,`employees' . $advQueryRecord['id'] . '`.`middle_name`,`employees' . $advQueryRecord['id'] . '`.`last_name`)', ':employee' . $advQueryRecord['id'], $advQueryRecord['comparator'], $advQueryRecord['andor'] == 'AND');
             $criteriaGroup->addBindParameter(':employee' . $advQueryRecord['id'], $advQueryRecord['value']);
             return false;
             break;
         default:
             return true;
             break;
     }
 }