How To Print Magento 2 Collection Query String

I knew we can use toString method to print out the SQL query of collection, How can I do for Magento 2

Its using same method – toString() as Magento to print out the SQL query of collection.

echo $collection->getSelect()->__toString();
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments