title: How to check if model have particular property or not?
body: <p>I want to create one new model class, which will be extended in all other class. I want to auto set some fields when admin is addind/editing any record. i.e. createdDate, createdIp, updatedDate, updatedIp..etc. </p>
  
  <p>Now my issue all fields will not be common in all models. So i want to check if object has createdDate property then only set it's value. If there will be no condition and model has not createdDate member then it will generate error. Below is code what i am trying. But it is not working.</p>
  
  <pre><code>public function beforeSave()
  { 
              if(isset($this-&gt;createdDate))
                      die('this model have createdDate field');
              else
                      die('this model does not have createdDate field');
  }
  </code></pre>
  
  <p>Model may not straight forward, it may extend database table related class automatically. Below is printed object. createdDate field is in private list.</p>
  
  <p>If i am using <code>var_dump(property_exists($this, 'createdDate'));</code>  it is giving me false.</p>
  
  <pre><code>AdvertisementRate Object
  (
      [bannerLocation_search] =&gt; 
      [bannerType_search] =&gt; 
      [_md:private] =&gt; CActiveRecordMetaData Object
          (
              [tableSchema] =&gt; CMysqlTableSchema Object
                  (
                      [schemaName] =&gt; 
                      [name] =&gt; tbl_advertisement_rate
                      [rawName] =&gt; `tbl_advertisement_rate`
                      [primaryKey] =&gt; advertisementRateId
                      [sequenceName] =&gt; 
  
                      [columns] =&gt; Array
                          (
                              [createdDate] =&gt; CMysqlColumnSchema Object
                                  (
                                      [name] =&gt; createdDate
                                      [rawName] =&gt; `createdDate`
                                      [allowNull] =&gt; 
                                      [dbType] =&gt; datetime
                                      [type] =&gt; string
                                      [defaultValue] =&gt; 
                                      [size] =&gt; 
                                      [precision] =&gt; 
                                      [scale] =&gt; 
                                      [isPrimaryKey] =&gt; 
                                      [isForeignKey] =&gt; 
                                      [autoIncrement] =&gt; 
                                      [_e:private] =&gt; 
                                      [_m:private] =&gt; 
                                  )
  </code></pre>
  
  <p>Please help me to add this logic.</p>
  
  <hr>
  
  <p>yes.. CActiveRecord is extended to my class.</p>
  
  <p>MasterAdmin.php</p>
  
  <pre><code>class MasterAdmin extends CActiveRecord
  {
      public function beforeSave()
      { 
                  echo '&lt;pre&gt;';
                  var_dump(property_exists($this, 'createdDate')); 
                  exit;
      }
  }
  </code></pre>
  
  <p>User.php</p>
  
  <pre><code>class User extend MasterAdmin 
  {
     // So whenever any record added or edited, beforeSave will be called and i can autoset createddate value.
  
  }
  </code></pre>