[CORE][DB] Don't do column renaming if a list of entities is specified

This commit is contained in:
Hugo Sales 2021-11-29 15:28:40 +00:00 committed by Diogo Peralta Cordeiro
parent ed5f6b6eed
commit 4f7e243bee
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0

View File

@ -127,7 +127,7 @@ class DB
if ($_ENV['APP_ENV'] === 'dev' && str_starts_with($query, 'select *')) { if ($_ENV['APP_ENV'] === 'dev' && str_starts_with($query, 'select *')) {
throw new Exception('Cannot use `select *`, use `select {select}` (see ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT)'); throw new Exception('Cannot use `select *`, use `select {select}` (see ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT)');
} }
$rsmb = new ResultSetMappingBuilder(self::$em, ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT); $rsmb = new ResultSetMappingBuilder(self::$em, \is_null($entities) ? ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT : ResultSetMappingBuilder::COLUMN_RENAMING_NONE);
if (\is_null($entities)) { if (\is_null($entities)) {
$matches = []; $matches = [];
preg_match_all(self::$table_entity_pattern, $query, $matches); preg_match_all(self::$table_entity_pattern, $query, $matches);