flightphp / active-record

Micro Active Record library in PHP, supports chain calls, events, and relations.
https://docs.flightphp.com/awesome-plugins/active-record
MIT License
8 stars 3 forks source link

Can you add a method to obtain sql? #6

Closed SyanH closed 6 months ago

SyanH commented 7 months ago

In some cases, you need to view the generated sql for debugging. Thanks!

n0nag0n commented 6 months ago

Hey there....sorry for some reason I was set to not get any notifications :man_shrugging:

So for now, what you actually could do is installed Tracy and then there's the https://github.com/flightphp/tracy-extensions that you could install which would provide a debugging panel to see all the queries executing on a page load. Super helpful. There's more info in the docs

SyanH commented 6 months ago

Thanks

n0nag0n commented 6 months ago

I ended up adding this anyway with another issue I needed to fix. https://github.com/flightphp/active-record/releases/tag/v0.4.1 After running your find/update method, you can capture the query with $YourRecord->getBuiltSql()