Merge pull request #16691 from mattwire/eventcart_cleanup
[civicrm-core.git] / api / v3 / utils.php
index dd90088fe6c8f1f90245d77a23f14412c99f3bd7..65fe0128da644190210b43379f0efa653048b7ef 100644 (file)
@@ -171,7 +171,7 @@ function civicrm_api3_create_success($values = 1, $params = [], $entity = NULL,
     }
   }
 
-  if (is_array($params) && !empty($params['debug'])) {
+  if (is_array($params) && $entity && !empty($params['debug'])) {
     if (is_string($action) && $action !== 'getfields') {
       $apiFields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => $action] + $params);
     }
@@ -1357,7 +1357,7 @@ function _civicrm_api3_basic_create_fallback($bao_name, &$params) {
 
   CRM_Utils_Hook::pre($hook, $entityName, CRM_Utils_Array::value('id', $params), $params);
   $instance = new $dao_name();
-  $instance->copyValues($params, TRUE);
+  $instance->copyValues($params);
   $instance->save();
   CRM_Utils_Hook::post($hook, $entityName, $instance->id, $instance);
 
@@ -2442,10 +2442,6 @@ function _civicrm_api3_api_resolve_alias($entity, $fieldName, $action = 'create'
  */
 function _civicrm_api3_deprecation_check($entity, $result = []) {
   if ($entity) {
-    $apiFile = "api/v3/$entity.php";
-    if (CRM_Utils_File::isIncludable($apiFile)) {
-      require_once $apiFile;
-    }
     $lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity);
     $fnName = "_civicrm_api3_{$lowercase_entity}_deprecation";
     if (function_exists($fnName)) {