Skip to content

Commit

Permalink
[Task]: Quote name and description (#198)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
kingjia90 and dvesh3 committed Feb 1, 2023
1 parent 956e184 commit 1895d2e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Controller/AdminController.php
Expand Up @@ -20,6 +20,7 @@
use AdvancedObjectSearchBundle\Model\SavedSearch;
use AdvancedObjectSearchBundle\Service;
use Pimcore\Bundle\AdminBundle\Helper\QueryParams;
use Pimcore\Db;
use Pimcore\Model\DataObject;
use Pimcore\Tool;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down Expand Up @@ -313,6 +314,7 @@ public function findAction(Request $request)
$offset = $offset ? $offset : 0;
$limit = $limit ? $limit : 50;

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

//filter for query
if (!empty($query)) {
$conditionParts[] = '(name LIKE ? OR description LIKE ? OR category LIKE ?)';
$conditionParts[] = sprintf('(%s LIKE ? OR %s LIKE ? OR %s LIKE ?)',
$db->quoteIdentifier('name'),
$db->quoteIdentifier('description'),
$db->quoteIdentifier('category')
);
$conditionParams[] = '%' . $query . '%';
$conditionParams[] = '%' . $query . '%';
$conditionParams[] = '%' . $query . '%';
Expand Down

0 comments on commit 1895d2e

Please sign in to comment.