I've been looking for the answer for an hour or two and can't find it. I have this class that extends Zend_Db_Table_Abstract
where I fill the table name and its primary key. Here it is:
<?php
class Produit_Model_DbTable_Fiche extends Zend_Db_Table_Abstract
{
/**
* @var string
*/
protected $_name = 'table_name';
/**
* @var string
*/
protected $_primary = 'primary';
public function getName()
{
return $this->_name;
}
public function getPrimary()
{
return $this->_primary;
}
}
As you can see, the protected attribute _primary is a string. However, when I retrieve this info via $db->getPrimary()
in the following code, it is returned as an array which has only one entry [1] => 'id'
.
// $db is an instance of Produit_Model_DbTable_Fiche
$select = $db->select();
$select->from($db, $columns)
->where($db->info('primary').' = ?', $id);
$row = $db->fetchRow($select);
The error message states that Column not found: 1054 Unknown column 'Array' in 'where clause'
because, as I said, I'm trying to echo an array with $db->info('primary')
whereas I expect it to be a string.
PS: I've seen this question/answer but I'm still in the blur : Zend_Db_Table_Abstract::_primary returns array?