Browse Source

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

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
515095bbf7
  1. 10
      apps/advanced/common/models/User.php
  2. 1
      framework/CHANGELOG.md

10
apps/advanced/common/models/User.php

@ -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
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],

1
framework/CHANGELOG.md

@ -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)

Loading…
Cancel
Save