From a788f505fbea2839b4a73113b936cd011f5de066 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Wed, 19 Jun 2013 15:01:30 +0400 Subject: [PATCH] Model::formName() correct PHP 5.3 code --- framework/yii/base/Model.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/framework/yii/base/Model.php b/framework/yii/base/Model.php index b9b7d2d..aedf0b0 100644 --- a/framework/yii/base/Model.php +++ b/framework/yii/base/Model.php @@ -186,9 +186,8 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess, Jsona */ public function formName() { - $class = get_class($this); - $pos = strrpos($class, '\\'); - return $pos === false ? $class : substr($class, $pos + 1); + $reflector = new \ReflectionClass($this); + return $reflector->getShortName(); } /**