Skip to content

Commit 1895d2e

Browse files
kingjia90dvesh3
andauthored
[Task]: Quote name and description (#198)
* Task: quote `name` and `description` * Task: fix quoteidentifier to use the 6.9 supported approach * Quote category as well Co-authored-by: Divesh Pahuja <divesh.pahuja@pimcore.com> --------- Co-authored-by: Divesh Pahuja <divesh.pahuja@pimcore.com>
1 parent 956e184 commit 1895d2e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Controller/AdminController.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use AdvancedObjectSearchBundle\Model\SavedSearch;
2121
use AdvancedObjectSearchBundle\Service;
2222
use Pimcore\Bundle\AdminBundle\Helper\QueryParams;
23+
use Pimcore\Db;
2324
use Pimcore\Model\DataObject;
2425
use Pimcore\Tool;
2526
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -313,6 +314,7 @@ public function findAction(Request $request)
313314
$offset = $offset ? $offset : 0;
314315
$limit = $limit ? $limit : 50;
315316

317+
$db = Db::get();
316318
$searcherList = new SavedSearch\Listing();
317319
$conditionParts = [];
318320
$conditionParams = [];
@@ -327,7 +329,11 @@ public function findAction(Request $request)
327329

328330
//filter for query
329331
if (!empty($query)) {
330-
$conditionParts[] = '(name LIKE ? OR description LIKE ? OR category LIKE ?)';
332+
$conditionParts[] = sprintf('(%s LIKE ? OR %s LIKE ? OR %s LIKE ?)',
333+
$db->quoteIdentifier('name'),
334+
$db->quoteIdentifier('description'),
335+
$db->quoteIdentifier('category')
336+
);
331337
$conditionParams[] = '%' . $query . '%';
332338
$conditionParams[] = '%' . $query . '%';
333339
$conditionParams[] = '%' . $query . '%';

0 commit comments

Comments
 (0)