I'm on zend framework 2.
The scenario is, I want to know the actual SQL query after Zend\Db\Sql\Select
. I cannot use Zend\Db\Sql\SQL
here, and
$select = new Zend\Db\Sql\Select();
$select->where(array($between));
$select->prepareStatement($select)->getSQL();
is giving error like,
Call to a member function getParameterContainer() on null
What is the correct way to write it?
You need to use getSqlString() method.
More info you can find here: https://akrabat.com/displaying-the-generated-sql-from-a-zenddbsql-object/