コード例 #1
0
 /**
  * Sets a Relationship field, or a category field, to a given value
  *
  * @see Doctrine_Record
  */
 public function set($fieldName, $value, $load = true)
 {
     //try Relationship first
     if (array_key_exists($fieldName, $this->_data) || $this->_table->hasRelation($fieldName)) {
         return parent::set($fieldName, $value, $load);
     }
     //then try the category
     $fields = $this->getCategoryFields(true);
     if (in_array($fieldName, $fields)) {
         $this->_categoryObject->set($fieldName, $value, $load);
     } else {
         //the field doesn't exist: do what the parent would do
         parent::set($fieldName, $value, $load);
     }
     return $this;
 }