Commit 515095bb by Alexander Makarov

Fixes #1633: Advanced application template now works with MongoDB by default

parent ccd4ae9f
...@@ -68,11 +68,11 @@ class User extends ActiveRecord implements IdentityInterface ...@@ -68,11 +68,11 @@ class User extends ActiveRecord implements IdentityInterface
} }
/** /**
* @return int|string current user ID * @return int|string|array current user ID
*/ */
public function getId() public function getId()
{ {
return $this->id; return $this->getPrimaryKey();
} }
/** /**
...@@ -104,6 +104,12 @@ class User extends ActiveRecord implements IdentityInterface ...@@ -104,6 +104,12 @@ class User extends ActiveRecord implements IdentityInterface
public function rules() public function rules()
{ {
return [ return [
['status', 'default', 'value' => self::STATUS_ACTIVE],
['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]],
['role', 'default', 'value' => self::ROLE_USER],
['role', 'in', 'range' => [self::ROLE_USER]],
['username', 'filter', 'filter' => 'trim'], ['username', 'filter', 'filter' => 'trim'],
['username', 'required'], ['username', 'required'],
['username', 'string', 'min' => 2, 'max' => 255], ['username', 'string', 'min' => 2, 'max' => 255],
......
...@@ -36,6 +36,7 @@ Yii Framework 2 Change Log ...@@ -36,6 +36,7 @@ Yii Framework 2 Change Log
- Enh #1581: Added `ActiveQuery::joinWith()` and `ActiveQuery::innerJoinWith()` to support joining with relations (qiangxue) - Enh #1581: Added `ActiveQuery::joinWith()` and `ActiveQuery::innerJoinWith()` to support joining with relations (qiangxue)
- Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight) - Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight)
- Enh #1611: Added `BaseActiveRecord::markAttributeDirty()` (qiangxue) - Enh #1611: Added `BaseActiveRecord::markAttributeDirty()` (qiangxue)
- Enh #1633: Advanced application template now works with MongoDB by default (samdark)
- Enh #1634: Use masked CSRF tokens to prevent BREACH exploits (qiangxue) - Enh #1634: Use masked CSRF tokens to prevent BREACH exploits (qiangxue)
- Enh #1641: Added `BaseActiveRecord::updateAttributes()` (qiangxue) - Enh #1641: Added `BaseActiveRecord::updateAttributes()` (qiangxue)
- Enh #1646: Added postgresql `QueryBuilder::checkIntegrity` and `QueryBuilder::resetSequence` (Ragazzo) - Enh #1646: Added postgresql `QueryBuilder::checkIntegrity` and `QueryBuilder::resetSequence` (Ragazzo)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment