I have PHP class as follow:
class SearchAttributeDao extends BaseDao
{
private $SELECT_CATEGORY_FILTER_BY_IDS;
function __construct()
{
$this->table_name = 'categoryattributes';
$this->SELECT_CATEGORY_ATTR_BY_IDS = "SELECT csa.attributeid, atn.name FROM "
.$this->table_name.
" csa join attributenames atn on csa.attributeid = atn.attributeid where csa.categoryid in (?); ";
}
public function getListByCatIds(array $catIds)
{
//...
$attr_list = $this->executeSelectQuery($this->SELECT_CATEGORY_FILTER_BY_IDS, [$catIds]); //Error on this line
//...
}
}
So when I executes my application I get an error stating:
SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty (SQL: ) ... at BaseDao->executeSelectQuery(null, array(array('10523', '10524', '10606', '10423', '10533', '10618'))) in SearchAttributeDao.php line 24
The stacktrace above suggest that SELECT_CATEGORY_FILTER_BY_IDS
is null or empty but I have set it in constructor. What I have done wrong?