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