projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3749 from civicrm/4.4
[civicrm-core.git]
/
CRM
/
Utils
/
API
/
ReloadOption.php
diff --git
a/CRM/Utils/API/ReloadOption.php
b/CRM/Utils/API/ReloadOption.php
index 92e9e55b0b3599011727224fa3d3799c303fae62..c1fa5583aee109b5d01e95fd14ecafbba99f7e15 100644
(file)
--- a/
CRM/Utils/API/ReloadOption.php
+++ b/
CRM/Utils/API/ReloadOption.php
@@
-1,9
+1,9
@@
<?php
/*
+--------------------------------------------------------------------+
<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.
3
|
+ | CiviCRM version 4.
5
|
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-201
3
|
+ | Copyright CiviCRM LLC (c) 2004-201
4
|
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@@
-26,8
+26,8
@@
*/
/**
*/
/**
- * Implement the "
api.reload" option. This option can be used with "create" to
- *
force
the API to reload a clean copy of the entity before returning the result.
+ * Implement the "
reload" option. This option can be used with "create" to force
+ * the API to reload a clean copy of the entity before returning the result.
*
* @code
* $clean = civicrm_api('myentity', 'create', array(
*
* @code
* $clean = civicrm_api('myentity', 'create', array(
@@
-38,11
+38,15
@@
* @endcode
*
* @package CRM
* @endcode
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-201
3
+ * @copyright CiviCRM LLC (c) 2004-201
4
* $Id$
*/
require_once 'api/Wrapper.php';
* $Id$
*/
require_once 'api/Wrapper.php';
+
+/**
+ * Class CRM_Utils_API_ReloadOption
+ */
class CRM_Utils_API_ReloadOption implements API_Wrapper {
/**
class CRM_Utils_API_ReloadOption implements API_Wrapper {
/**
@@
-72,7
+76,7
@@
class CRM_Utils_API_ReloadOption implements API_Wrapper {
*/
public function toApiOutput($apiRequest, $result) {
$reloadMode = NULL;
*/
public function toApiOutput($apiRequest, $result) {
$reloadMode = NULL;
- if ($apiRequest['action'] === 'create' && isset($apiRequest['params'], $apiRequest['params']['options']
,
$apiRequest['params']['options']['reload'])) {
+ if ($apiRequest['action'] === 'create' && isset($apiRequest['params'], $apiRequest['params']['options']
) && is_array($apiRequest['params']['options']) && isset(
$apiRequest['params']['options']['reload'])) {
if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
$reloadMode = $apiRequest['params']['options']['reload'];
}
if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
$reloadMode = $apiRequest['params']['options']['reload'];
}
@@
-82,6
+86,7
@@
class CRM_Utils_API_ReloadOption implements API_Wrapper {
case NULL:
case '0':
case 'null':
case NULL:
case '0':
case 'null':
+ case '':
return $result;
case '1':
return $result;
case '1':
@@
-106,7
+111,7
@@
class CRM_Utils_API_ReloadOption implements API_Wrapper {
return $result;
default:
return $result;
default:
- throw new API_Exception("Unknown reload mode
"
);
+ throw new API_Exception("Unknown reload mode
" . $reloadMode
);
}
}
}
}