I was doing ok learning Yii 1.1 and decided to try my hand at Yii2. I am having a basic problem with the login and get the following error using the basic template.
"Call to undefined method app\models\User::findByUsername()"
Is this a function I have to write myself (I can do that) or is there suppose to be something and I missed it when I setup the basic app. (It was my first time using Composer)
I agree, The model "User" that I have does not have that or FindByIdentity() in it. Here is what my User model has in it. (after running gii)
<?php
namespace app\models;
use yii\db\ActiveRecord;
use yii\helpers\SecurityHelper;
use yii\web\Identity;
/**
* This is the model class for table "user".
*
* @property integer $id
* @property string $fName
* @property string $lName
* @property string $email
* @property string $address
* @property string $city
* @property string $state
* @property string $password
*/
class User extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'user';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'fName', 'lName', 'email', 'password'], 'required'],
[['id'], 'integer'],
[['address', 'city'], 'string'],
[['fName', 'lName'], 'string', 'max' => 30],
[['email', 'password'], 'string', 'max' => 60],
[['state'], 'string', 'max' => 10]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'fName' => 'F Name',
'lName' => 'L Name',
'email' => 'Email',
'address' => 'Address',
'city' => 'City',
'state' => 'State',
'password' => 'Password',
];
}
}
I had not thought of looking at the file on Github as I assumed it would be the same as what I have. (I will not make that mistake again) Is it possible that I used composer wrong and got the wrong version of the basic app? Sorry, this is all new to me and I am slowly learning all the tools plus the language, plus the framework. (I miss the old days of classic ASP and Dreamweaver