Exemplo n.º 1
0
 function store($dealId, $locationIdArr)
 {
     $currentLocations = EnmasseModelDealLocation::getLocationByDealId($dealId);
     if (count($currentLocations) == 0) {
         for ($i = 0; $i < count($locationIdArr); $i++) {
             EnmasseModelDealLocation::save($dealId, $locationIdArr[$i]);
         }
     } else {
         for ($z = 0; $z < count($currentLocations); $z++) {
             EnmasseModelDealLocation::delete($dealId, $currentLocations[$z]);
         }
         for ($i = 0; $i < count($locationIdArr); $i++) {
             EnmasseModelDealLocation::save($dealId, $locationIdArr[$i]);
         }
     }
 }
Exemplo n.º 2
0
 function store($dealId, $locationIdArr)
 {
     $currentLocations = EnmasseModelDealLocation::getLocationByDealId($dealId);
     if (count($currentLocations) == 0) {
         for ($i = 0; $i < count($locationIdArr); $i++) {
             EnmasseModelDealLocation::save($dealId, $locationIdArr[$i]);
         }
     } else {
         for ($z = 0; $z < count($currentLocations); $z++) {
             EnmasseModelDealLocation::delete($dealId, $currentLocations[$z]);
         }
         for ($i = 0; $i < count($locationIdArr); $i++) {
             EnmasseModelDealLocation::save($dealId, $locationIdArr[$i]);
         }
         //			for($i=0 ; $i < count($locationIdArr); $i++)
         //			{
         //				for($x=0 ; $x < count($currentLocations); $x++)
         //				{
         //					if($currentLocations[$x] != $locationIdArr[$i])
         //					{
         //						EnmasseModelDealLocation::save($dealId,$locationIdArr[$i]);
         //					}
         //
         //				}
         //			}
         //
         //			for($z=0 ; $z < count($currentLocations); $z++)
         //			{
         //				$available = false;
         //				for($y=0; $y < count($locationIdArr); $y++)
         //				{
         //					if($currentLocations[$z] == $locationIdArr[$y])
         //					{
         //						$available = true;
         //					}
         //				}
         //
         //				if(!$available)
         //				{
         //					EnmasseModelDealLocation::delete($dealId,$currentLocations[$z]);
         //				}
         //			}
     }
 }