public function saveImagesHasProductList($con = null) { if (!$this->isValid()) { throw $this->getErrorSchema(); } if (!isset($this->widgetSchema['images_has_product_list'])) { // somebody has unset this widget return; } if (null === $con) { $con = $this->getConnection(); } $c = new Criteria(); $c->add(ImagesHasProductPeer::IMAGES_ID, $this->object->getPrimaryKey()); ImagesHasProductPeer::doDelete($c, $con); $values = $this->getValue('images_has_product_list'); if (is_array($values)) { foreach ($values as $value) { $obj = new ImagesHasProduct(); $obj->setImagesId($this->object->getPrimaryKey()); $obj->setProductId($value); $obj->save(); } } }
/** * saving our sets of keys albumid+imageid at album_has_image table * @param int $albumId * @param array $imagesIds */ protected function saveImageProductConnections($productId, $imagesIds) { foreach ($imagesIds as $ids) { $item = new ImagesHasProduct(); $item->setProductId($productId); $item->setImagesId($ids); $item->save(); } }