/**
  * Lists all TeamWork models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => TeamWork::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
<?php

use app\models\TeamWork;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Project */
/* @var $form yii\widgets\ActiveForm */
$teamWorkItems = ArrayHelper::map(TeamWork::find()->all(), function (TeamWork $teamWork) {
    return $teamWork->id;
}, function (TeamWork $teamWork) {
    return $teamWork->name;
});
?>

<div class="project-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'team_work_id')->dropDownList($teamWorkItems);
?>

    <?php