Closed chomyczek closed 9 years ago
Funkcji findIdentity nie ma w modelu User i Yii nie może jej użyć.
A jeżeli powiem, że nic z tamtego pliku nie usunąłem?
Możesz pokazać zawartość pliku common/models/User.php
?
Powiem tylko, że utworzyłem to na nowym szkielecie Yii, więc nie zdąrzyłem nic zjebać :p
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "user".
*
* @property integer $id
* @property string $username
* @property string $auth_key
* @property string $password_hash
* @property string $password_reset_token
* @property string $email
* @property integer $status
* @property integer $created_at
* @property integer $updated_at
*
* @property Zamowienie[] $zamowienies
*/
class User extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'user';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['username', 'auth_key', 'password_hash', 'email', 'created_at', 'updated_at'], 'required'],
[['status', 'created_at', 'updated_at'], 'integer'],
[['username', 'password_hash', 'password_reset_token', 'email'], 'string', 'max' => 255],
[['auth_key'], 'string', 'max' => 32]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('app', 'ID'),
'username' => Yii::t('app', 'Username'),
'auth_key' => Yii::t('app', 'Auth Key'),
'password_hash' => Yii::t('app', 'Password Hash'),
'password_reset_token' => Yii::t('app', 'Password Reset Token'),
'email' => Yii::t('app', 'Email'),
'status' => Yii::t('app', 'Status'),
'created_at' => Yii::t('app', 'Created At'),
'updated_at' => Yii::t('app', 'Updated At'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getZamowienies()
{
return $this->hasMany(Zamowienie::className(), ['uzytkownik_id' => 'id']);
}
}
:anger: I czyli mówisz, że nic nie zmieniałeś, a funkcja zniknęła? :interrobang: Oryginalny plik User.php załączyłeś w issue #21
:information_source: Są tam również adnotacje, co w tym pliku jest ważne i czego nie wolno usuwać.
Czy migracja mogła mi zniszczyć system?
Migracja - nie, ale generowanie modelu User - tak
Zacząłem od nowa, bez generowania modelu User, teraz działa :stuck_out_tongue:
udało mi się zmigrować tabele user (tak jak w #10) by udało się zalogować, nastepnie w bazie danych dodałem nową tabelę odwołującą się do user.id i utworzyłem kontroler tej tabeli i teraz nie działa. Wyświetla się następujący komunikat:
ten komunikat wyświetla się na stronie głównej i każdej innej