CRM-21127 Event API return request params format is partially outdated

    Details

    • Versioning Impact:
      Minor (add functionality in backwards-compatible manner)
    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds
    • Verified?:
      No

      Description

      According to the api explorer a request for getting events with certain return values (like is_full) should look like this:

      $result = civicrm_api3('Event', 'getsingle', array(
        'sequential' => 1,
        'return' => array("is_full"),
        'id' => 441,
      ));
      

      But this doesn't return the expected result (including is_full):

      {
          "id": "441",
          "is_full": 0,
          "is_error": 0
      }
      

      Instead my requested return value is missing, but price_set_id is given:

      {
          "id": "441",
          "price_set_id": "",
          "is_error": 0
      }
      

      I've checked civicrm_api3_event_get and noticed, that the api function is still expecting the old return syntax (with return.foo instead of return => ['foo']) for some (but not all) values (like is_full):

      if (!empty($params['return.is_full'])) {
        _civicrm_api3_event_getisfull($events, $id);
      }
      

      I think it should be

      if (!empty($params['return']['is_full'])) {
        _civicrm_api3_event_getisfull($events, $id);
      }
      

      Other return values like title or is_active are not effected, because they are returned by the _civicrm_api3_basic_get, which is working as expected (with the new return format).

      And why I get price_set_id? Because of

      if (!empty($options['return'])) {
        $events[$id]['price_set_id'] = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $id);
      }

      But the doesn't make sense at all (at least to me).

       

        Attachments

          Activity

          [CRM-21127] Event API return request params format is partially outdated
          Coleman Watts added a comment -

          Philipp Michael I've submitted a PR to address your concerns. Can you please check https://github.com/civicrm/civicrm-core/pull/10984

            People

            • Assignee:
              Eileen McNaughton
              Reporter:
              Philipp Michael

              Dates

              • Created:
                Updated:
                Resolved: