abdfahim
Well-known member
Is there any risk with
Here is what I am doing now
where('tag', 'like', '%'.$search.'%')
? I can see XF internally uses something like where('tag', 'like', $finder->escapeLike($search, '?%'))
, however, I need to pass where clause to repository, so not sure if I can use $finder->escapeLike
.Here is what I am doing now
PHP:
$where = [];
if($params['pname'] != ''){
array_push($where, ['User.username', 'LIKE', '%'.$params['pname'].'%']);
}
if($params['par1'] != ''){
array_push($where, ['col1', 'LIKE', '%'.$params['par1'].'%']);
}
if($params['par2'] != ''){
array_push($where, ['col1', 'LIKE', '%'.$params['par2'].'%']);
}
/** @var \AbdForo\TestPortal\Repository\TestPortal $repo */
$repo = $this->repository('AbdForo\TestPortal:TestPortal');
$finder = $repo->findMDTimelineForPortalView($where);
PHP:
public function findTestPortalView(array $where = [])
{
$finder = $this->finder('AbdForo\TestPortal:TestPortal');
$finder ->with('User', true) ->where($where);
return $finder;
}