/**
  * Magic method for writing properties.
  * This method is overriden to provide write access to the foreign objects via
  * the key names declared in the RELATIONS array.
  * @param string property name
  * @param mixed property value.
  * @since 3.1.2
  */
 public function __set($name, $value)
 {
     if ($this->hasRecordRelation($name) && !$this->canSetProperty($name)) {
         $this->{$name} = $value;
     } else {
         parent::__set($name, $value);
     }
 }