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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Help using OO version of v3 API?
Pages: [1]

Author Topic: Help using OO version of v3 API?  (Read 236 times)

bdmc

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.5.5
  • CMS version: Joomla 2.5.25 / Joomla 3.x
  • MySQL version: 5.5.40
  • PHP version: 5.3.10
Help using OO version of v3 API?
September 04, 2014, 08:05:20 am
I have been hunting through the Examples and various API Documentation, and find references to using the API in a PHP OO manner.

However, I guess that I am slow, because either the pieces of code that I have read are syntactically correct, or don't tell the whole story.

The Examples seem to be exclusively Procedural, so they are no help, and the API Explorer is the same.

Does anybody have any suggestions, pointing me at working examples of OO API code?


Specifically, I tried $contact = $api->Contact->Get( $params ), and I get a boolean result ( TRUE ), but no actual data.  $api->count returns 1, so I think that there should be data somewhere, but I don't know where to look for it.


Thanks,
Brian

bdmc

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.5.5
  • CMS version: Joomla 2.5.25 / Joomla 3.x
  • MySQL version: 5.5.40
  • PHP version: 5.3.10
Re: Help using OO version of v3 API?
September 04, 2014, 08:54:20 am
OK, further experimentation shows that $api->result carries the result.

Then, reading the class.api.php file, I see that if I do:

foreach ( $api->values as $v ), I get all of the values of the Contact object in $v for each record returned.


Brian

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Help using OO version of v3 API?

This forum was archived on 2017-11-26.