add fulcrm_webhook_set_mapping function

master
Marek Isalski 7 years ago
parent a024a46b48
commit f0cd48f06e

@ -46,6 +46,24 @@ function fulcrm_webhook_get_pk_for_entity_type( $entity_type, $entity_id, $fulcr
return $result->fetchField(); return $result->fetchField();
} }
function fulcrm_webhook_set_mapping( $entity_type, $bundle, $entity_id, $fulcrm_type, $fulcrm_pk ) {
db_merge( 'fulcrm_webhook_entity_mapping' )
->key( array( 'entity_type' => $entity_type,
'bundle' => $bundle,
'entity_id' => $entity_id,
) )
->insertFields( array( 'fulcrm_type' => $fulcrm_type,
'fulcrm_pk' => $fulcrm_pk,
'entity_type' => $entity_type,
'bundle' => $bundle,
'entity_id' => $entity_id,
) )
->updateFields( array( 'fulcrm_type' => $fulcrm_type,
'fulcrm_pk' => $fulcrm_pk,
) )
->execute();
}
function fulcrm_webhook_load_entity_for_url( $url ) { function fulcrm_webhook_load_entity_for_url( $url ) {
$fulcrm_type = fulcrm_apiv2_url_to_type( $url ); $fulcrm_type = fulcrm_apiv2_url_to_type( $url );
$fulcrm_pk = fulcrm_apiv2_url_to_pk( $url ); $fulcrm_pk = fulcrm_apiv2_url_to_pk( $url );

Loading…
Cancel
Save