开发者

Cakephp Auth problem : Undefined property: User::$alias

I keep getting this error over a day right now.

I search over and over , but i couldnt get an answer.

Probably i am making sometihing stupid.

Here is my enviroment;

UserController :

class UsersController extends AppController {

    var $name = 'Users';
    var $components = array('Email');

    function login() {
    }

    function home() {
        pre('login oldunuz');
    }

    function logout() {
        $this->Session->setFlash(__('Goodbye!', true));
        $this->redirect($this->Auth->logout());
    }

    ....

}

AppController : class AppController extends Controller {

    var $components = array('Session','Auth');
    function beforeFilter() {
        $this->Auth->loginError = 'You didnt supply valid identification.';
        $this->Auth->authError = 'You are not validated to see this location.';
        $this->Auth->allowedActions = array('register','confirm');
        $this->Auth->userScope = array('User.active' => 1);
    }
    function beforeRender() {
        $this->set('User', $this->Session->read('Auth.User'));
    }

}

UserModel: class User extends AppModel { var $name = 'User'; var $displayField = 'username';

var $validate = array(
    'username' => array(
        'notempty' => array(
            'rule' => array('notempty'),
            'message' => 'Username field can not be empty..',
        ),
        'u_unique' => array(
            'rule'=>array('isUnique'),
            'message' => 'The username you selected, is being used please choose another one.'
        )
    ),
    'email' => array(
        'email' => array(
            'rule' => array('email'),
            'message' => 'Please provide a valid email.',
        ),
        'e_unique' => array(
            'rule' => array('isUnique'),
            'message' => 'The email you selected, is being used please choose another one.'
        )
    ),
    ----

  /* if you want i send 开发者_如何转开发more of this code */

}

I dont how to fix this, But for helping, cakephp says :

The error portion is :

if ($key == null)
{
    $model =& $this->getModel();
    return array($model->alias => $this->Session->read($this->sessionKey));
}

if i make $model->alias = "User" then it works but where ever another $model->alias is used, it explodes same as before,

I hope you have an answer, thanks all,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜