Esempio n. 1
0
 private static function AddUpgradeProducts($id, $upgradeproducts)
 {
     $i = 0;
     // Delete all the products related before adding the new one
     ProductsUpgrades::delItemsbyProductID($id);
     $upgrade = new Doctrine_Collection('ProductsUpgrades');
     if (!empty($upgradeproducts)) {
         foreach ($upgradeproducts as $item) {
             $upgrade[$i]->upgrade_product_id = $item;
             $upgrade[$i]->product_id = $id;
             $i++;
         }
         $upgrade->save();
     }
 }