platform icon indicating copy to clipboard operation
platform copied to clipboard

Round function from doctrine-extensions not registered

Open jimohalloran opened this issue 4 years ago • 2 comments

Summary
The oro/doctrine-extensions package provides a round function. However the OroEntityBundle does not register it and it can't be used.

Steps to reproduce
Try to call "ROUND()" in a DQL query (such as that generated from a datagrid) results in an error indicasting that "ROUND()" is an unknown function (Syntax error).

Actual Result Syntax error.

Expected Result
Query is executed and value is rounded as expected.

Details about your environment

  • OroPlatform version: 4.1.13
  • PHP version: N/A
  • Database (MySQL, PostgreSQL) version: MySQL

Additional information
I can see at https://github.com/oroinc/platform/blob/master/src/Oro/Bundle/EntityBundle/Resources/config/oro/app.yml#L24 a lot of functions provided by this bundle are registered, but round is not. I don't know if there's an issue with the round function specifically, or whether it not being registered is an oversight.

I have registered this function from an app.yml in my own bundle and used it. It does seem to work, so I dopn't understand why platform doesn't register it for you?

jimohalloran avatar Jun 21 '21 05:06 jimohalloran

Hi, @jimohalloran Thank you for your response. Doctrine extensions is a separate project that provides a set of useful functions that allow transparent usage of MySQL or PostgreSQL in your application. At the moment platform has no need in the ROUND DQL function, so it was not registered. Registering a new DQL function with app.yml when needed is expected behavior.

x86demon avatar Jun 21 '21 07:06 x86demon

Hi @x86demon , Thanks for that info. It seemed odd that most of the functions from that package were registered, but not ROUND(). If this is expected, I assume there are no issues with adding an app.yml into one of my own bundles and registering it? Having done so already, it seems to work fine and I can't see that it could/would break anything.

jimohalloran avatar Jun 22 '21 01:06 jimohalloran