protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $rt_shop_attribute = $form->save(); // Clean product cache for linked products foreach ($rt_shop_attribute->rtShopProducts as $rt_shop_product) { rtShopProductCacheToolkit::clearCache($rt_shop_product); } $action = $request->getParameter('rt_post_save_action', 'index'); if ($action == 'edit') { $this->redirect('rtShopAttributeAdmin/edit?id=' . $rt_shop_attribute->getId()); } $this->redirect('rtShopAttributeAdmin/index'); } $this->getUser()->setFlash('default_error', true, false); }
/** * Clean the cache relating to rtShopProduct * * @param rtShopProduct $rt_shop_product */ private function clearCache($rt_shop_product = null) { rtShopProductCacheToolkit::clearCache($rt_shop_product); }
/** * Remove Cache for products altered in the order submission * * @param array $product_ids */ public function clearCache($product_ids = array()) { foreach ($this->getOrder()->getStockInfoArray() as $stock) { $product_ids[$stock['product_id']] = $stock['product_id']; } foreach ($product_ids as $id) { $product = Doctrine::getTable('rtShopProduct')->find($id); if ($product) { rtShopProductCacheToolkit::clearCache($product); } } }