2011-10-07 49 views
0

我的模型中有以下代碼。我希望展示個人和專業。但目前我的下面的代碼不工作,因爲我只是加了一個加號來獲得兩個。單獨我能夠顯示個人或專業。如何更改下面的代碼以顯示個人和專業的所有結果?返回用戶的cakephp中的所有結果

function getAll($in_id){ 
      $this->PassionsUser->id = $in_id; 
    return $this->PassionsUser->find('all', array(
       'conditions' => array(
        'PassionsUser.user_id' => $in_id, 
        'PassionsUser.type' => 'personal' 
       ) 
      )); + $this->PassionsUser->id = $in_id; 
    return $this->PassionsUser->find('all', array(
       'conditions' => array(
        'PassionsUser.user_id' => $in_id, 
        'PassionsUser.type' => 'professional' 
       ) 


)); 
} 

回答

0

這應該工作:

function getAll($id){ 
    return $this->PassionsUser->find('all', 
    array(
     'conditions' => array(
     'PassionsUser.user_id' => $id, 
     'PassionsUser.type' => array('personal', 'professional') 
     ) 
    ) 
    ); 
} 

否則,看到蛋糕的或能力here