Ejemplo n.º 1
0
 public function setEnabled($enable)
 {
     parent::setEnabled($enable);
     if (!$enable) {
         return;
     }
     if (empty($this->attribute)) {
         throw new CException('Attribute property must be set.');
     }
     if (empty($this->extension)) {
         throw new CException('Extension property must be set.');
     }
     if (array_key_exists('normal', $this->formats)) {
         $this->formats['normal'] = array_merge(self::$_normalFormat, $this->formats['normal']);
     } else {
         $this->formats['normal'] = self::$_normalFormat;
     }
     // set suffixes if not defined
     foreach ($this->formats as $name => $f) {
         if (!array_key_exists('suffix', $f)) {
             $f['suffix'] = $name;
         }
     }
 }
 /**
  * Enables or disables the behavior.
  * 
  * @param bool $value whether this behavior is enabled
  */
 public function setEnabled($value)
 {
     parent::setEnabled($value);
     if ($value) {
         if ($this->getOwner()) {
             $this->_addInfoRelations();
         }
     } else {
         if ($this->getOwner()) {
             $this->_removeInfoRelations();
         }
     }
 }