Download the PHP package shipmonk/doctrine-hint-driven-sql-walker without Composer
On this page you can find all versions of the php package shipmonk/doctrine-hint-driven-sql-walker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shipmonk/doctrine-hint-driven-sql-walker
More information about shipmonk/doctrine-hint-driven-sql-walker
Files in shipmonk/doctrine-hint-driven-sql-walker
Package doctrine-hint-driven-sql-walker
Short Description Doctrine's SqlWalker that allows hooking multiple handlers via ->setHint() while each can edit produced SQL or its part.
License MIT
Informations about the package doctrine-hint-driven-sql-walker
SqlWalker for Doctrine allowing multiple handlers to modify resulting SQL
Since Doctrine's SqlWalker serves as a translator from DQL AST to SQL, it becomes problematic when you want to alter resulting SQL within multiple libraries by such approach. There just can be only single SqlWalker.
This library solves this issue, by providing HintHandler
base class which is designed for SQL modification
and can be used multiple times in $queryBuilder->setHint()
.
Installation:
Usage:
Where MaxExecutionTimeHintHandler
just extends our HintHandler
and picks some SqlNode
to hook to and alters appropriate SQL part:
SqlNode is an enum of all walkXxx
methods in Doctrine's SqlWalker, so you are able to intercept any part of AST processing the SqlWalker does.
Limitations
- Please note that since doctrine/orm 3.3.0, the produced SQL gets finalized with
LIMIT
/OFFSET
/FOR UPDATE
afterSqlWalker
processing is done.- Thus, implementors should be aware that those SQL parts can be appended to the SQL after
HintHandler
processing. - This means that e.g. placing a comment at the end of the SQL breaks LIMIT functionality completely
- Thus, implementors should be aware that those SQL parts can be appended to the SQL after
Implementors
- shipmonk/doctrine-mysql-optimizer-hints (since v2)
- shipmonk/doctrine-mysql-index-hints (since v3)
Compatibility
Version | PHP Compatibility | doctrine/orm |
---|---|---|
v1 | 7.2 - 8.3 | 2.x |
v2 | 8.1 - 8.4 | 3.x |