<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Grid\Filter; use ModStart\Core\Util\StrUtil; class Like extends AbstractFilter { private $handle = null; public function condition($GWC6A) { if (isset($GWC6A['like']) && $GWC6A['like'] !== '') { if (!empty($this->handle)) { return call_user_func_array($this->handle, array($GWC6A['like'])); } else { return $this->buildCondition($this->column, 'like', "%{$GWC6A['like']}%"); } } return null; } public function handle(\Closure $oRPSk) { $this->handle = $oRPSk; } public function wordSplit() { $this->handle = function ($hnXpY) { return array(array('where' => array(function ($hAzJ1) use($hnXpY) { $yQ4Wg = StrUtil::wordSplit($hnXpY); foreach ($yQ4Wg as $v2qOY) { $hAzJ1->where($this->column, 'like', '%' . $v2qOY . '%'); } }))); }; } }