Move getSQLResultCasing code into ORM from DBAL #6802

Closed
opened 2026-01-22 15:38:57 +01:00 by admin · 2 comments
Owner

Originally created by @beberlei on GitHub (Aug 5, 2021).

DBAL 2 deprecates and DBAL 3 removes the getSQLResultCasing API, which we use to work around Oracle, PostgreSQL and MySQL differences in the default result casing.

To avoid a larger refactoring and be forwards compatible, we need move this functionality into ORM and provide a strategy pattern with different implementations based on DBAL 2 or 3.

interface ResultCasingStrategy
{
    public function getSQLResultCasing(string $string) : string;
}
class DBAL2ResultCasingStrategy implements ResultCasingStrategy {
     public function getSQLResultCasing(string $string) : string {
         return $this->platform->getSQLResultCasing($string);
     }
}
class UpperCaseResultCasingStrategy implements ResultCasingStrategy {}
class LowerCaseResultCasingStrategy implements ResultCasingStrategy {}
class NullCasingStrategy implements ResultCasingStrategy {}

A factory method at some point in the ORM should select the right strategy based on DBAL version and database platform and make the service available to everyone who needs sql result casings.

Originally created by @beberlei on GitHub (Aug 5, 2021). DBAL 2 deprecates and DBAL 3 removes the `getSQLResultCasing` API, which we use to work around Oracle, PostgreSQL and MySQL differences in the default result casing. To avoid a larger refactoring and be forwards compatible, we need move this functionality into ORM and provide a strategy pattern with different implementations based on DBAL 2 or 3. ```php interface ResultCasingStrategy { public function getSQLResultCasing(string $string) : string; } class DBAL2ResultCasingStrategy implements ResultCasingStrategy { public function getSQLResultCasing(string $string) : string { return $this->platform->getSQLResultCasing($string); } } class UpperCaseResultCasingStrategy implements ResultCasingStrategy {} class LowerCaseResultCasingStrategy implements ResultCasingStrategy {} class NullCasingStrategy implements ResultCasingStrategy {} ``` A factory method at some point in the ORM should select the right strategy based on DBAL version and database platform and make the service available to everyone who needs sql result casings.
admin closed this issue 2026-01-22 15:38:58 +01:00
Author
Owner

@greg0ire commented on GitHub (Aug 23, 2021):

Actually, I don't think the factory part has been done. @beberlei , can you please review #8934 and tell us if more work is necessary?

@greg0ire commented on GitHub (Aug 23, 2021): Actually, I don't think the factory part has been done. @beberlei , can you please review #8934 and tell us if more work is necessary?
Author
Owner

@beberlei commented on GitHub (Sep 25, 2021):

@greg0ire its flexible enough that I believe this issue can be closed for now.

@beberlei commented on GitHub (Sep 25, 2021): @greg0ire its flexible enough that I believe this issue can be closed for now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6802