Exemple #1
0
 public function setData($key, $value = null)
 {
     if (is_null($value) and is_array($key)) {
         return $this->mergeData($key);
     }
     parent::__set($key, $value);
     return $this;
 }
Exemple #2
0
 public function __set($columnName, $value)
 {
     try {
         return parent::__set($columnName, $value);
     } catch (Exception $e) {
         return $this->_setRelation(ucfirst($columnName), $value);
     }
 }
Exemple #3
0
 /**
  * Set row field value
  *
  * @param  string $columnName The column key.
  * @param  mixed  $value      The value for the property.
  * @return void
  * @throws Zend_Db_Table_Row_Exception
  */
 public function __set($columnName, $value)
 {
     try {
         parent::__set($columnName, $value);
     } catch (Zend_Db_Table_Row_Exception $e) {
         if (array_key_exists($columnName, $this->_related)) {
             $this->_related[$columnName] = $value;
         } elseif (array_key_exists($columnName, $this->_virtual)) {
             $this->_virtual[$columnName] = $value;
         } else {
             throw $e;
         }
     }
 }
Exemple #4
0
 public function set($name, $value)
 {
     var_dump($name);
     parent::__set($name, $value);
 }
 /**
  * Overrides the magic set method to handle foreign keys. If the requested attribute
  * is a foreign key object, then we set the foreign key and its associated id attributes.
  * If the requested attribute is a foreign key id column, we unset the associated foreign
  * key object attribute if the id is different, to allow lazy loading the new object
  * later when needed. Otherwise, we just call the parent set method.
  * @param string $name The attribute to set.
  * @param mixed $value The value of the attribute.
  */
 public function __set($name, $value)
 {
     if ($this->hasForeignKey($name)) {
         $this->_setForeignObject($name, $value);
     } else {
         if ($this->_data[$name] != $value) {
             $foreignKey = $this->getForeignKey($name);
             if (!is_null($foreignKey)) {
                 $this->_setForeignObject($foreignKey, null);
             }
             parent::__set($name, $value);
         }
     }
 }