Example #1
0
 public function setAttributes($attributes)
 {
     parent::setAttributes($attributes);
     if (isset($attributes['id'])) {
         $this->id = (int) $attributes['id'];
     }
     if (isset($attributes['active'])) {
         $this->active = (bool) $attributes['active'];
     }
 }
Example #2
0
 public function setAttributes($aAttributes)
 {
     return parent::setAttributes($aAttributes);
 }
 /**
  * @param $name
  *
  * @return Model|null
  */
 public function getSettingsByMailerName($name)
 {
     $settings = null;
     if (is_null($this->configs)) {
         $this->configs = craft()->config->get('sproutEmail');
     }
     if (isset($this->configs['apiSettings'][$name])) {
         $configs = $this->configs['apiSettings'][$name];
     }
     if ($mailer = $this->getMailerByName($name, true)) {
         $settings = new Model($mailer->defineSettings());
     }
     if ($mailer) {
         $record = $this->getMailerRecordByName($name);
         $settingsFromDb = isset($record->settings) ? $record->settings : array();
         $settingsFromFile = isset($configs) ? $configs : array();
         $settings->setAttributes(array_merge($settingsFromDb, $settingsFromFile));
     }
     return $settings;
 }
Example #4
0
 /**
  * @inheritdoc
  * @param array $values
  * @return Model
  */
 public function prepSettings($values)
 {
     $settingsModel = new Model($values);
     $settingsModel->setAttributes($values);
     return $settingsModel;
 }