public function doSave($con = null) { $pk = $this->getQuery()->execute()->getPrimaryKeys(); Doctrine_Query::create()->delete('ParameterProductOption ppo')->where('product_id = ?', $this->getObject()->getId())->whereIn('option_id', $pk)->execute(); if (is_array($this->getValue('parameter_options_list'))) { foreach ($this->getValue('parameter_options_list') as $paramOptionID) { $ppo = new ParameterProductOption(); $ppo->fromArray(array('product_id' => $this->getObject()->id, 'option_id' => $paramOptionID)); $ppo->save(); } } else { $ppo = new ParameterProductOption(); $ppo->fromArray(array('product_id' => $this->getObject()->id, 'option_id' => $this->getValue('parameter_options_list'))); $ppo->save(); } }