2013-01-22 25 views
0

我難倒。Zend框架DB選擇沒有得到數據爲全行

我有一組數據庫,用於存放客戶端數據,例如client_personal中的個人詳細信息以及client_contact中的聯繫人詳細信息等。有6個連接用於收集整行信息。所以,邏輯上(或者我認爲),我做到了。

$oSelect->from(array('details' => 'client_details')) 
     ->joinLeft(array('contact' => 'client_contact'), 'contact.client_id = details.id') 
     ->joinLeft(array('other' => 'client_other_details'), 'other.client_id = details.id') 
     ->joinLeft(array('nok'  => 'client_nextofkin'), 'nok.client_id = details.id') 
     ->joinLeft(array('notes' => 'client_notes'), 'notes.client_id = details.id') 
     ->joinLeft(array('contract' => 'client_contract'), 'contract.client_id = details.id') 
     ->joinLeft(array('image' => 'client_image'), 'image.client_id = details.id') 
     ->where('details.id = ?', $cid); 

現在,這返回了大量的信息,但它缺少我測試數據中的一些字段。例如,client_contact包含:

id client_id email phone mobile phone address postcode country 

雖然我已經驗證了所有的領域舉辦一些測試數據,我得到的數據,除「手機」和「地址」每一個領域 - 手機是一個varchar (11)字段,相同的移動,其中,我發現了數據抽出來,地址是一個文本字段,相同的郵政編碼(對於此測試的目的),該我還獲取數據。

它不會迷路 - 運行->fetch()後立即發現var_dump()表明它只是沒有從數據庫中獲取數據。我甩掉了這段代碼產生的聲明並自己運行,並獲得了所有行中的數據。

這是怎麼回事?

回答

0

沒關係。這裏發生的事情與兩個表的內容有關 - client_details和client_nextofkin。

舉行領域這兩個表標有「地址」和「手機」,由於近親表的走進了聯繫方式表後加入,這些領域都在我的ResultSet覆蓋。