Example #1
0
 /**
  * @param array $data
  * @param \Shopware\Models\Tax\Tax $model
  */
 private function saveTaxRules(array $data, \Shopware\Models\Tax\Tax $model)
 {
     if (isset($data['rules'])) {
         $model->getRules()->clear();
         $rules = array();
         foreach ($data['rules'] as $ruleData) {
             $rule = new Shopware\Models\Tax\Rule();
             $rule->fromArray($ruleData);
             $rule->setGroup($model);
             $rules[] = $rule;
         }
         $data['rules'] = $rules;
         $model->fromArray($data);
         $this->getModelManager()->persist($model);
         $this->getModelManager()->flush();
     }
     $this->View()->assign(array('success' => true));
 }
 /**
  * {@inheritDoc}
  */
 public function getRules()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getRules', array());
     return parent::getRules();
 }