diff --git a/framework/yii/YiiBase.php b/framework/yii/YiiBase.php index a5a3833..c96a969 100644 --- a/framework/yii/YiiBase.php +++ b/framework/yii/YiiBase.php @@ -100,7 +100,6 @@ class YiiBase */ public static $objectConfig = array(); - private static $_imported = array(); // alias => class name or directory /** * @return string the version of Yii framework @@ -111,40 +110,6 @@ class YiiBase } /** - * Imports a class by its alias. - * - * This method is provided to support autoloading of non-namespaced classes. - * Such a class can be specified in terms of an alias. For example, the alias `@old/code/Sample` - * may represent the `Sample` class under the directory `@old/code` (a path alias). - * - * By importing a class, the class is put in an internal storage such that when - * the class is used for the first time, the class autoloader will be able to - * find the corresponding class file and include it. For this reason, this method - * is much lighter than `include()`. - * - * You may import the same class multiple times. Only the first importing will count. - * - * @param string $alias the class to be imported. This may be either a class alias or a fully-qualified class name. - * If the latter, it will be returned back without change. - * @return string the actual class name that `$alias` refers to - * @throws Exception if the alias is invalid - */ - public static function import($alias) - { - if (strncmp($alias, '@', 1)) { - return $alias; - } else { - $alias = static::getAlias($alias); - if (!isset(self::$_imported[$alias])) { - $className = basename($alias); - self::$_imported[$alias] = $className; - self::$classMap[$className] = $alias . '.php'; - } - return self::$_imported[$alias]; - } - } - - /** * Imports a set of namespaces. * * By importing a namespace, the method will create an alias for the directory corresponding @@ -431,10 +396,6 @@ class YiiBase throw new InvalidConfigException('Object configuration must be an array containing a "class" element.'); } - if (!class_exists($class, false)) { - $class = static::import($class); - } - $class = ltrim($class, '\\'); if (isset(self::$objectConfig[$class])) { diff --git a/framework/yii/validators/ExistValidator.php b/framework/yii/validators/ExistValidator.php index 9c74890..8cbce5f 100644 --- a/framework/yii/validators/ExistValidator.php +++ b/framework/yii/validators/ExistValidator.php @@ -66,7 +66,7 @@ class ExistValidator extends Validator } /** @var $className \yii\db\ActiveRecord */ - $className = $this->className === null ? get_class($object) : Yii::import($this->className); + $className = $this->className === null ? get_class($object) : $this->className; $attributeName = $this->attributeName === null ? $attribute : $this->attributeName; $query = $className::find(); $query->where(array($attributeName => $value)); diff --git a/framework/yii/validators/UniqueValidator.php b/framework/yii/validators/UniqueValidator.php index b650693..c3876e8 100644 --- a/framework/yii/validators/UniqueValidator.php +++ b/framework/yii/validators/UniqueValidator.php @@ -61,7 +61,7 @@ class UniqueValidator extends Validator } /** @var $className \yii\db\ActiveRecord */ - $className = $this->className === null ? get_class($object) : Yii::import($this->className); + $className = $this->className === null ? get_class($object) : $this->className; $attributeName = $this->attributeName === null ? $attribute : $this->attributeName; $table = $className::getTableSchema(); diff --git a/framework/yii/web/User.php b/framework/yii/web/User.php index b1ca8c2..e02559b 100644 --- a/framework/yii/web/User.php +++ b/framework/yii/web/User.php @@ -140,7 +140,7 @@ class User extends Component $this->_identity = null; } else { /** @var $class Identity */ - $class = Yii::import($this->identityClass); + $class = $this->identityClass; $this->_identity = $class::findIdentity($id); } }