/** * agregating method to using all methods above to save images, titles and * album_images connections */ protected function saveImagesToProduct() { //getting our album id and all values from formfield 'images' $productId = $this->getObject()->getId(); $images = $this->getValue('images'); //then saving our new images(getting ids) and titles for all images $images = $this->saveTitlesForCurrentImages($images); $images = $this->saveTitlesForNewImages($images); //next step destroy all connections at album_has_image for current album ImagesHasProductPeer::cleanUp($productId); //and finally save new connections foreach ($images as $im) { if (isset($im['ids'])) { $this->saveImageProductConnections($productId, $im['ids']); } } }