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