私は次の表を持って教義select文は、常にテーブルのすべてのフィールド
Test:
tableName: test
columns:
test_id:
name: test_id as id
primary: true
autoincrement: true
type: integer
notnull: true
test_name:
name: test_name as name
type: string(255)
test_title:
name: test_title as title
type: string(255)
このDQL声明
$dql = Doctrine_Query::create()->select('t.name')->from('Model_Test t');
次のSQL ISTは
SELECT t.test_id AS t__test_id, t.test_name AS t__test_name FROM test t
が、後を生成返します教義の結果をフェッチすると、選択されていなくてもタイトルフィールドにアクセスできます:
foreach ($results as $result) {
foreach ($result as $filed => $value) {
echo "$filed => $value <hr>"; // echoes 'title' => null but title in db has other value
}
}
また、Zend_Debug :: dump($ results-> toArray())によるダンプ。すべてのフィールドを選択したかのように表示*
どのように返されたフィールドを自分の選択に合わせて制限するか?事前
マーティン
選択したフィールドが含まれていますあなたは、このための解決策を見つけましたか?私もそれで苦労しています。私はajax消費者のためにjsonとして不要なゴミを渡したくない。 –
Nevermind、 - > setHydrationMode(Doctrine :: HYDRATE_ARRAY)が解決しました。 –