X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FAPI%2FSubscriber%2FAPIv3SchemaAdapter.php;h=3831cdf4d8b9a8af98c0d19d5473c9e2b794a9a9;hb=46d87393f7bd29c1a5416e62207293f58115412c;hp=649ec9c7ccf530422194225f9c6fe6eafd1bcaca;hpb=8282c3dc7b991acb4665546aae5c18e1adaecf95;p=civicrm-core.git diff --git a/Civi/API/Subscriber/APIv3SchemaAdapter.php b/Civi/API/Subscriber/APIv3SchemaAdapter.php index 649ec9c7cc..3831cdf4d8 100644 --- a/Civi/API/Subscriber/APIv3SchemaAdapter.php +++ b/Civi/API/Subscriber/APIv3SchemaAdapter.php @@ -35,16 +35,17 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * and validates that the fields are provided correctly. */ class APIv3SchemaAdapter implements EventSubscriberInterface { + /** * @return array */ public static function getSubscribedEvents() { - return array( - Events::PREPARE => array( - array('onApiPrepare', Events::W_MIDDLE), - array('onApiPrepare_validate', Events::W_LATE), - ), - ); + return [ + Events::PREPARE => [ + ['onApiPrepare', Events::W_MIDDLE], + ['onApiPrepare_validate', Events::W_LATE], + ], + ]; } /** @@ -81,6 +82,9 @@ class APIv3SchemaAdapter implements EventSubscriberInterface { */ public function onApiPrepare_validate(\Civi\API\Event\Event $event) { $apiRequest = $event->getApiRequest(); + if ($apiRequest['version'] > 3) { + return; + } // Not sure why this is omitted for generic actions. It would make sense // to omit 'getfields', but that's only one generic action. @@ -96,7 +100,7 @@ class APIv3SchemaAdapter implements EventSubscriberInterface { * @return array */ public function getDefaults($fields) { - $defaults = array(); + $defaults = []; foreach ($fields as $field => $values) { if (isset($values['api.default'])) { @@ -112,7 +116,7 @@ class APIv3SchemaAdapter implements EventSubscriberInterface { * @return array */ public function getRequired($fields) { - $required = array('version'); + $required = ['version']; foreach ($fields as $field => $values) { if (!empty($values['api.required'])) {