Calling Developers!
We are reenergizing our code contribution process! Learn More

When building propel query, is it possible to get final SQL as string?

Options
U039B0RUXMF
U039B0RUXMF Posts: 39 🧑🏻‍🚀 - Cadet
edited June 2023 in Propel ORM

When building propel query, is it possible to get final SQL as string?

Tagged:

Best Answer

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer
    Answer ✓
    Options

    Only via debugger when it's executed (\Propel\Runtime\ActiveQuery\QueryExecutor\AbstractQueryExecutor::executeStatement) which has the advantage that you can see the passed in parameters as well.

    You can also set $config[PropelConstants::PROPEL_DEBUG] = true to log all queries into a log file.

Answers

  • U017Y69D9U4
    U017Y69D9U4 Posts: 34 🧑🏻‍🚀 - Cadet
    Options

    I think on the query object you can call toString() or something similar which should give you the actual SQL query?

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer
    Answer ✓
    Options

    Only via debugger when it's executed (\Propel\Runtime\ActiveQuery\QueryExecutor\AbstractQueryExecutor::executeStatement) which has the advantage that you can see the passed in parameters as well.

    You can also set $config[PropelConstants::PROPEL_DEBUG] = true to log all queries into a log file.