rename it to fulcrm_webhook_set_entity_mapping and start to use it

master
Marek Isalski 7 years ago
parent f0cd48f06e
commit 371ce858a0

@ -46,7 +46,7 @@ function fulcrm_webhook_get_pk_for_entity_type( $entity_type, $entity_id, $fulcr
return $result->fetchField();
}
function fulcrm_webhook_set_mapping( $entity_type, $bundle, $entity_id, $fulcrm_type, $fulcrm_pk ) {
function fulcrm_webhook_set_entity_mapping( $entity_type, $bundle, $entity_id, $fulcrm_type, $fulcrm_pk ) {
db_merge( 'fulcrm_webhook_entity_mapping' )
->key( array( 'entity_type' => $entity_type,
'bundle' => $bundle,
@ -110,12 +110,12 @@ function fulcrm_webhook_createupdate_entity( $data ) {
$function( $return );
if ( array_key_exists( 'entity', $return ) ) {
db_insert( 'fulcrm_webhook_entity_mapping' )->fields( array( 'fulcrm_type' => $fulcrm_type,
'fulcrm_pk' => $fulcrm_pk,
'entity_type' => $return[ 'entity_type' ],
'bundle' => array_key_exists( 'bundle', $return ) ? $return[ 'bundle' ] : $return[ 'entity_type' ],
'entity_id' => $return[ 'entity_id' ],
) )->execute();
fulcrm_webhook_set_entity_mapping( $fulcrm_type = $fulcrm_type,
$fulcrm_pk = $fulcrm_pk,
$entity_type = $return[ 'entity_type' ],
$bundle = array_key_exists( 'bundle', $return ) ? $return[ 'bundle' ] : $return[ 'entity_type' ],
$entity_id = $return[ 'entity_id' ],
);
return $return;
}
}

Loading…
Cancel
Save