Example #1
0
 /**
  * Link the price set with the specified table and id.
  *
  * @param string $entityTable
  * @param int $entityId
  * @param int $priceSetId
  *
  * @return bool
  */
 public static function addTo($entityTable, $entityId, $priceSetId)
 {
     // verify that the price set exists
     $dao = new CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set();
     $dao->id = $priceSetId;
     if (!$dao->find()) {
         return FALSE;
     }
     unset($dao);
     $dao = new CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity();
     // find if this already exists
     $dao->entity_id = $entityId;
     $dao->entity_table = $entityTable;
     $dao->find(TRUE);
     // add or update price_set_id
     $dao->price_set_id = $priceSetId;
     return $dao->save();
 }