CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • how do you fetch a nested array of events in 1.9?
Pages: [1]

Author Topic: how do you fetch a nested array of events in 1.9?  (Read 2371 times)

rob123

  • Guest
how do you fetch a nested array of events in 1.9?
January 04, 2008, 11:07:25 am
Hi all,

I need to retreive a nested array of multiple events based on 'event type id'.

For version 2 the API does this with ease using civicrm_event_search:
http://wiki.civicrm.org/confluence/display/CRMDOC/Using+CiviCRM+APIs+-+Code+Snippets#UsingCiviCRMAPIs-CodeSnippets-ListPublicEventsbyEventTypeinaBlock

Unfortunately I'm running 1.9 and the only function for retreiving events is crm_get_event() which just returns an array of properties from an INDIVIDUAL event based on an 'event id'.

Does anyone know how to do the equivalent of civicrm_event_search in 1.9?

Thanks in advance!

Rob

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: how do you fetch a nested array of events in 1.9?
January 04, 2008, 05:09:59 pm

the v2 API is part of CiviCRM v1.9. we've been transitioning to a simpler API since v1.7 (or so), which we've been calling v2 API (yes, this is a bad and confusing name, sorry about that).

You should be able to use that snippet for v1.9

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

rob123

  • Guest
Re: how do you fetch a nested array of events in 1.9?
January 04, 2008, 10:58:12 pm
Donald,

I was all geared up to writing a custom script to get it done when I read your reply!

Thanks very much for clearing that up, it's working wonderfully!

Rob
« Last Edit: January 05, 2008, 04:34:10 am by rob123 »

rob123

  • Guest
Re: how do you fetch a nested array of events in 1.9?
January 05, 2008, 12:35:54 am
I notice that some of the values in the array are repeated. Just curious if there's any recommendation for which to use (in case of future deprecation):

$event[title]
$event[event_title]

$event[start_date]
$event[event_start_date]

$event[end_date]
$event[event_end_date]

Rob

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: how do you fetch a nested array of events in 1.9?
January 05, 2008, 06:47:20 am

You might want to use event_title to be a bit safer (we use two names since title is a common column in quite a few tables). So most of our code would reference event_title if we think there might be a potential conflict

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

rob123

  • Guest
Re: how do you fetch a nested array of events in 1.9?
January 05, 2008, 09:09:12 am
thanks again

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • how do you fetch a nested array of events in 1.9?

This forum was archived on 2017-11-26.