public function testProject_Ok()
 {
     $user = User::findByLogin('test');
     $result = Project::find('all', array('joins' => array('members'), 'select' => 'projects.identifier,members.user_id,members.role_id', 'conditions' => array('user_id = ?', $user->id)));
     $this->assertEquals(4, $result[0]->role_id);
     $this->assertEquals(3, $result[1]->role_id);
 }
示例#2
0
 /**
  * @param $id
  * @return array|null|\yii\db\ActiveRecord
  * @throws HttpException
  */
 public function findModel($id)
 {
     $model = Project::find()->published()->andWhere(['id' => (int) $id])->one();
     if (!$model) {
         throw new HttpException(404);
     }
     return $model;
 }
 public function projectCodeIsAvailable($projectCode)
 {
     // only includes 'public' projects for now
     $project = Project::findByIdentifier($projectCode);
     return json_encode($project == null);
 }