public function saveProductHasColorList($con = null) { if (!$this->isValid()) { throw $this->getErrorSchema(); } if (!isset($this->widgetSchema['product_has_color_list'])) { // somebody has unset this widget return; } if (null === $con) { $con = $this->getConnection(); } $c = new Criteria(); $c->add(ProductHasColorPeer::COLOR_ID, $this->object->getPrimaryKey()); ProductHasColorPeer::doDelete($c, $con); $values = $this->getValue('product_has_color_list'); if (is_array($values)) { foreach ($values as $value) { $obj = new ProductHasColor(); $obj->setColorId($this->object->getPrimaryKey()); $obj->setProductId($value); $obj->save(); } } }