Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support to allow CActiveRecord::getAttributes() to return custo…

…m attributes if required
  • Loading branch information...
commit 3157a66880f812d20d5124ff10e2cb5ea5df8af5 1 parent 783a13e
qiang.xue authored
Showing with 8 additions and 2 deletions.
  1. +1 −0  CHANGELOG
  2. +7 −2 framework/db/ar/CActiveRecord.php
View
1  CHANGELOG
@@ -45,6 +45,7 @@ Version 1.1.2 to be released
- Enh: CFileValidator now works with php.ini's upload_max_filesize strings with K, G, k, m, g (Sam Dark)
- Enh: Enhanced CActiveForm to make it more robust in case some code error occurs when performing ajax validation (Qiang)
- Enh: CMaskedTextField's jquery.maskedinput updated to 1.2.2 (Sam Dark)
+- Enh: Added support to allow CActiveRecord::getAttributes() to return custom attributes if required (Qiang)
- Chg #1118: CActiveRecord::refresh() now updates the record by directly updating the attributes array (Qiang)
- Chg #1125: Ability to use model metadata in behavior's attach() method (Sam Dark)
- Chg #1163: CLinkPager will enable first and last page buttons unless the current page is first or last. (Qiang)
View
9 framework/db/ar/CActiveRecord.php
@@ -312,7 +312,7 @@ public function resetScope()
{
if($this->_c!==null)
$this->_c=new CDbCriteria();
-
+
return $this;
}
@@ -672,7 +672,12 @@ public function getAttributes($names=true)
{
$attrs=array();
foreach($names as $name)
- $attrs[$name]=isset($attributes[$name])?$attributes[$name]:null;
+ {
+ if(property_exists($this,$name))
+ $attrs[$name]=$this->$name;
+ else
+ $attrs[$name]=isset($attributes[$name])?$attributes[$name]:null;
+ }
return $attrs;
}
else
Please sign in to comment.
Something went wrong with that request. Please try again.