/**
  * @param EntryDistribution $entryDistribution
  * @param entry $entry
  * @param DistributionProfile $distributionProfile
  * @return boolean true if the list of flavors modified
  */
 public static function assignFlavorAssets(EntryDistribution $entryDistribution, entry $entry, DistributionProfile $distributionProfile)
 {
     $requiredFlavorParamsIds = $distributionProfile->getRequiredFlavorParamsIdsArray();
     $optionalFlavorParamsIds = $distributionProfile->getRequiredFlavorParamsIdsArray();
     $flavorParamsIds = array_merge($requiredFlavorParamsIds, $optionalFlavorParamsIds);
     $flavorAssetIds = array();
     if (!is_array($flavorParamsIds)) {
         return false;
     }
     $originalList = $entryDistribution->getFlavorAssetIds();
     // remove deleted flavor assets
     if ($originalList) {
         $assignedFlavorAssetIds = explode(',', $originalList);
         $assignedFlavorAssets = flavorAssetPeer::retrieveByIds($assignedFlavorAssetIds);
         foreach ($assignedFlavorAssets as $assignedFlavorAsset) {
             if (in_array($assignedFlavorAsset->getFlavorParamsId(), $flavorParamsIds)) {
                 $flavorAssetIds[] = $assignedFlavorAsset->getId();
             }
         }
     }
     // adds added flavor assets
     $newFlavorAssetIds = flavorAssetPeer::getReadyIdsByParamsIds($entry->getId(), $flavorParamsIds);
     foreach ($newFlavorAssetIds as $newFlavorAssetId) {
         $flavorAssetIds[] = $newFlavorAssetId;
     }
     $entryDistribution->setFlavorAssetIds($flavorAssetIds);
     return $originalList != $entryDistribution->getFlavorAssetIds();
 }