-
-
Notifications
You must be signed in to change notification settings - Fork 62
Closed
Labels
Description
Describe the bug
When calling $collection->countStored() on a table that has a column named count, invalid query is generated.
To Reproduce
Steps to reproduce the behavior. It could include:
- Create table with
countcolumn - Call
countStored()
$definition->keys->toCollection()
->findBy(['state' => 'active'])
->countStored()- Query like this will be generated
SELECT
`channel_definition_id`,
COUNT(DISTINCT `count`) as `count`
FROM
(
SELECT
`channel_definition_key`.*,
`channel_definition_key`.`id` AS `count`
FROM
`channel_definition_key` AS `channel_definition_key`
WHERE
(`channel_definition_key`.`state` = 'active')
AND (
`channel_definition_key`.`channel_definition_id` IN (3)
)
) AS `temp`
GROUP BY
`channel_definition_id`;Problem is in
`channel_definition_key`.`id` AS `count`
Possibly related code:
$boxingBuilder->addSelect('%column, COUNT(DISTINCT [count]) as [count]', $this->joinStorageKey);
Expected behavior
Working aliasing and valid query.
Versions::
- Database: mariadb 10.11
- Orm: v5.0.1
- Dbal: v5.0.1
konecnyjakub