Skip to content

Commit 49763b4

Browse files
committed
Fix sql statement errors.
1 parent 64a6e6f commit 49763b4

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/Attribute/Select.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,10 @@
2929
namespace MetaModels\AttributeSelectBundle\Attribute;
3030

3131
use Doctrine\DBAL\Connection;
32-
use Doctrine\DBAL\Statement;
32+
use Doctrine\DBAL\Driver\Statement;
3333

3434
/**
3535
* This is the MetaModelAttribute class for handling select attributes on plain SQL tables.
36-
*
37-
* @package MetaModels
38-
* @subpackage AttributeSelect
39-
* @author Christian Schiffler <[email protected]>
40-
* @author Christian de la Haye <[email protected]>
4136
*/
4237
class Select extends AbstractSelect
4338
{
@@ -176,8 +171,9 @@ public function getFilterOptionsForUsedOnly($usedOnly)
176171
{
177172
$additionalWhere = $this->getAdditionalWhere();
178173
$sortColumn = $this->getSortingColumn();
174+
179175
if ($usedOnly) {
180-
$this->connection->query(sprintf(
176+
return $this->connection->query(sprintf(
181177
'SELECT COUNT(%1$s.%2$s) as mm_count, %1$s.*
182178
FROM %1$s
183179
RIGHT JOIN %3$s ON (%3$s.%4$s=%1$s.%2$s)
@@ -195,7 +191,7 @@ public function getFilterOptionsForUsedOnly($usedOnly)
195191
));
196192
}
197193

198-
return $this->connection->execute(sprintf(
194+
return $this->connection->query(sprintf(
199195
'SELECT COUNT(%3$s.%4$s) as mm_count, %1$s.*
200196
FROM %1$s
201197
LEFT JOIN %3$s ON (%3$s.%4$s=%1$s.%2$s)
@@ -280,14 +276,13 @@ public function getDataFor($arrIds)
280276
'SELECT sourceTable.*, %2$s.id AS %3$s
281277
FROM %1$s sourceTable
282278
LEFT JOIN %2$s ON (sourceTable.%4$s=%2$s.%5$s)
283-
WHERE %2$s.id IN (%6$s)',
279+
WHERE %2$s.id IN (:ids)',
284280
// @codingStandardsIgnoreStart - We want to keep the numbers as comment at the end of the following lines.
285281
$strTableNameId, // 1
286282
$strMetaModelTableName, // 2
287283
$strMetaModelTableNameId, // 3
288284
$strColNameId, // 4
289-
$this->getColName(), // 5
290-
$this->parameterMask($arrIds) // 6
285+
$this->getColName() // 5
291286
// @codingStandardsIgnoreEnd
292287
)
293288
);

0 commit comments

Comments
 (0)