I have the following table on MSSQL server:
Superheroes: id,name,real_name,power
And as Input I have the following array:
$heroes=["Superman","Batman","Wonder Woman"]
And I want to fetch their real names using Zend Framework 2.3.2. Therefore on My model I have this function:
public function getHeroesRealNames(array $superHeroesNames)
{
/**
* @var Zend\Db\Adapter\AdapterInterface
*/
$db=$this->db;
$sql=new Sql($db);
$qb=new Select('dbo.Superheroes');
$qb->columns(['real_name'])->where('name IN (?)',$superHeroesNames);
$query_string=$sql->getSqlStringForSqlObject($bq)
var_dump($query_string);//Debug Output
}
But the var_dump
for debugging purposes returns:
SELECT [dbo.Superheroes].[real_name] AS [real_name] FROM [dbo.Superheroes] WHERE name IN ('')"
Instead of the full query. How can I fix that? please keep in note that I DO NOT use var_dump
in production.