kspitfire/pgsql-doctrine-round-function
Adds PostgreSQL ROUND() support to Doctrine ORM and DBAL. Register the custom DQL function to use ROUND in your queries with PostgreSQL, including numeric rounding with scale, without raw SQL. Lightweight and easy to configure in Symfony or plain Doctrine.
Architecture fit
ROUND() for PostgreSQL. It fits only where Doctrine ORM is the persistence layer and PostgreSQL is the database, or where it lives in a shared library consumed by a non-Laravel Doctrine service.DB::raw('ROUND(col, 2)'), selectRaw, or a cast/accessor already cover the need.FunctionNode subclass against Doctrine's sanctioned extension point (addCustomNumericFunction).Integration feasibility
doctrine/orm and PHP versions than the 2019 build did. That is a hypothesis to verify from composer.json, not an assumption to act on. The release note carries no dependency information.^1.0 constraint is now suspect.Technical risk
ROUND(x, -1)), the round(numeric, int) vs round(double precision) distinction, or declared DQL return type. None of the prior open questions are answered by this release.Key questions
doctrine/orm and PHP versions do the new constraints permit, and does it install cleanly on the target stack without --ignore-platform-reqs?ROUND(x) and ROUND(x, n)), and how is return type declared for numeric vs double precision?Stack fit
laravel-doctrine config), gated so it applies only to pgsql connections.Migration path
App\Doctrine\DQL\RoundFunction) and register it locally. The 1.3 release is a useful source of any fixes to copy from, but adopting it as a standing dependency re-acquires the abandonment risk you would otherwise eliminate.^1.3 specifically — never a range that can resolve to a pre-1.3 tag — for a spike, with an explicit ticket to vendor before the next Doctrine major upgrade.^1.0.Compatibility
numeric rounding is stable; implicit casts and double precision behavior depend on how the query is written.Sequencing
^1.3, register, run one representative DQL query, inspect generated SQL and hydrated types.Maintenance
FunctionNode/SqlWalker surface.Support
Scaling
ROUND(amount, 2) in a WHERE or JOIN predicate is non-sargable and bypasses plain B-tree indexes on amount. Plan expression indexes (CREATE INDEX ... ON t (ROUND(amount, 2))) or precomputed columns if the pattern spreads.Failure modes
ROUND.^1.0 could change rounding or argument handling with no review signal. Pin exactly if not vendoring.ROUND(double precision) rounds differently from ROUND(numeric); a query passing in test can round differently in production if column types differ.Ramp-up
FunctionNode, SqlWalker, DQL parsing), ramp-up is under an hour. For an Eloquent-only engineer this is a new mental model and should not be their first Doctrine task.How can I help you explore Laravel packages today?