Yii 2获取未知属性:common \ models \ User :: newMessagesCount

时间:2017-12-23 00:48:00

标签: php yii

我正在尝试使用Yii2 Podium在我的网站上建立论坛。但是在我安装之后我无法访问

  

讲台/家

我收到了这条消息:

Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: common\models\User::newMessagesCount

这是组件文件

  

在C:\ xampp \ htdocs \ tugasakhir \ vendor \ yiisoft \ yii2 \ base \ Component.php

public function __get($name)
{
    $getter = 'get' . $name;
    if (method_exists($this, $getter)) {
        // read property, e.g. getName()
        return $this->$getter();
    }

    // behavior property
    $this->ensureBehaviors();
    foreach ($this->_behaviors as $behavior) {
        if ($behavior->canGetProperty($name)) {
            return $behavior->$name;
        }
    }

    if (method_exists($this, 'set' . $name)) {
        throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
    }

    throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}

会出现什么问题?

1 个答案:

答案 0 :(得分:0)

您不必更改\ vendor \ yiisoft \ yii2 \ base \ Component.php中的任何内容,但您必须在设置\ models \ user中的变量时进行控制。

相关问题