本文整理汇总了PHP中Supplier::getAllByCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP Supplier::getAllByCriteria方法的具体用法?PHP Supplier::getAllByCriteria怎么用?PHP Supplier::getAllByCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Supplier
的用法示例。
在下文中一共展示了Supplier::getAllByCriteria方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchSupplier
/**
* Searching Customer
*
* @param unknown $sender
* @param unknown $param
*
* @throws Exception
*
*/
public function searchSupplier($sender, $param)
{
$results = $errors = array();
try {
$items = array();
$searchTxt = isset($param->CallbackParameter->searchTxt) ? trim($param->CallbackParameter->searchTxt) : '';
foreach (Supplier::getAllByCriteria('name like :searchTxt or contactName like :searchTxt', array('searchTxt' => $searchTxt . '%')) as $supplier) {
$items[] = $supplier->getJson();
}
$results['items'] = $items;
} catch (Exception $ex) {
$errors[] = $ex->getMessage();
}
$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
示例2: _getSuppliers
private function _getSuppliers(array $params)
{
$searchTxt = trim(isset($params['searchTxt']) ? $params['searchTxt'] : '');
$pageSize = isset($params['pageSize']) && ($pageSize = trim($params['pageSize'])) !== '' ? $pageSize : DaoQuery::DEFAUTL_PAGE_SIZE;
$pageNo = isset($params['pageNo']) && ($pageNo = trim($params['pageNo'])) !== '' ? $pageNo : null;
$orderBy = isset($params['orderBy']) ? $params['orderBy'] : array();
$where = array('name like :searchTxt or description like :searchTxt');
$sqlParams = array('searchTxt' => '%' . $searchTxt . '%');
$stats = array();
$items = Supplier::getAllByCriteria(implode(' AND ', $where), $sqlParams, true, $pageNo, $pageSize, $orderBy, $stats);
$results = array();
$results['items'] = array_map(create_function('$a', 'return $a->getJson();'), $items);
$results['pageStats'] = $stats;
return $results;
}