имеем вот такую ошибку http://yii.paintmedia.ru/basic/web/index.php?r=test
Написал простой пример. Есть модель:
Код: Выделить всё
namespace app\models;
class Test extends \yii\db\ActiveRecord
{
public $id;
public $username;
public static function tablename()
{
return 'user';
}
public static function findByID($id)
{
return self::find()->where(['id' => $id])->one();
}
}
Код: Выделить всё
namespace app\controllers;
use Yii;
use app\models\Test;
use yii\web\Controller;
class TestController extends Controller
{
public $id;
public $username;
public function behaviors()
{
return [];
}
public function actionIndex()
{
$model = new Test;
echo $model->findByID(1);
}
}