Exemple #1
0
 /**
  * Get settings.
  *
  * @return Yamm_EntitySettingsAbstract
  *   Return NULL if settings class does not exists or a new instance with
  *   defaults if none set.
  */
 public function getSettings()
 {
     if ($this->__settings) {
         return $this->__settings;
     }
     try {
         return Yamm_EntityFactory::getEntitySettingsInstance($this->_type);
     } catch (Yamm_Entity_ClassNotFoundException $e) {
         return NULL;
     }
 }
Exemple #2
0
 /**
  * (non-PHPdoc)
  * @see IFormable::formSubmit()
  */
 public function formSubmit(&$values)
 {
     $this->_options['backend'] = $values['backend']['backend_type'];
     try {
         $backend = $this->getBackend();
         $backend->formSubmit($values['backend']['backend_form']);
     } catch (Yamm_Sync_ProfileException $e) {
         /* Silent error. */
     }
     foreach ($values['types'] as $type) {
         $settings = Yamm_EntityFactory::getEntitySettingsInstance($type);
         $settings->formSubmit($values['entity_' . $type]);
         // Do not save empty options.
         if ($settings->getOptionsCount() > 0) {
             $this->_options['entity_' . $type] = $settings->getOptions();
         }
     }
 }