/** * 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_Price_DAO_PriceSet(); $dao->id = $priceSetId; if (!$dao->find()) { return FALSE; } unset($dao); $dao = new CRM_Price_DAO_PriceSetEntity(); // 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(); }