我有一個問題,我的課(由Zend_Db_Table_Abstract擴展),它返回,每次只有一排有一個連接,並選擇....當我用我的選擇Zend_Db_Table_Abstract和加入,使用fetchall還給我一個行
我在互聯網上搜索,但我沒有發現這個「bug」!
class Api_Model_News extends Zend_Db_Table_Abstract
{
protected $_name = 'news';
protected $_primary = 'news_id';
protected $select;
public function init()
{
$this->select = $this->select();
}
public function setTimestamp($timestamp)
{
$this->select
->where('news_timestamp >= ?', $timestamp);
return $this;
}
public function setCategory($id_category)
{
$this->select
->where('bsn_id_category = ?', $id_category);
return $this;
}
public function getNews()
{
$this->select
->from('news')
->joinLeft('business', 'news_id = bsn_id', array());
$data = $this->fetchAll($this->select);
return $data->toArray();
}
}
在另一功能:
$news = new Api_Model_News();
if ($id_category != NULL)
$news->setCategory($id_category);
if ($last_sync != NULL)
$news->setTimestamp($last_sync);
return $news->getNews();
- 當我設置
id_category
和不last_sync
=>只有一行 - 當我設置
last_sync
和不id_category
=>倍數行 - 當我設置了
last_sync
和id_category
=>只有一行
爲什麼?我想這是因爲我在select
中使用bsn_id_category
,但我不明白....
我該如何解決這個問題? =)
Calumah
帶或不帶setIntegrityCheck設爲假,我再次得到一行....:/ – Calumah