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) »
  • RFP: add a new param on civicrm_relationship_get
Pages: [1]

Author Topic: RFP: add a new param on civicrm_relationship_get  (Read 1189 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
RFP: add a new param on civicrm_relationship_get
December 01, 2009, 10:38:43 pm
Hi,

The behaviour is to return all relationships, both active and inactive. The BAO has an additional parameter status (eg 4 for only the active ones). Can I expose it in the api (and default to 0) ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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: RFP: add a new param on civicrm_relationship_get
December 02, 2009, 07:28:44 am

yes

can you please file an issue for this and tag your commit with the issue number

thanx

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

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: RFP: add a new param on civicrm_relationship_get
December 08, 2009, 03:27:45 am
Hi,

This is on the same function & sort of the same topic so I've added it to your thread...

My understanding is that the optimal api to call is the civicrm_relationship_get method. But I just can't figure out how you are supposed to know the valid keys to put in the array. The relationship methods seem to use a mix of 'contact_id' 'cid' contact_id_a'.

The alternative method  civicrm_contact_relationship_get has clear input parameters but I can't documented  anywhere where the options for the $params array that you pass to civicrm_relationship_get are outlined. I could go trawling through the code but I thought the point of the API was that you should be able to interact with the api without looking at the code behind it.

So once again - I think I just must be missing some obvious & fundamental piece of information that would make it clear to me how to interpret this easily. Specifically I was looking for what to call the key for the related contact.

e.g
Code: [Select]
$params['contact_id'] = 274;
$params['relationship_type_id']=4;
$outputParams= civicrm_relationship_get($params);
print_r($outputParams);

Code: [Select]

I know someone will give me the answer to what the key is called but my real question is how am I supposed to know what it is?

[quote]civicrm_relationship_get (line 217)

Function to get the relationship

    * return: of all relationship.
    * access: public

Array civicrm_relationship_get (array $params)

    * array $params: (reference ) input parameters[/quote]





civicrm_relationship_get (line 217)

Function to get the relationship

    * return: of all relationship.
    * access: public

Array civicrm_relationship_get (array $params)

    * array $params: (reference ) input parameters

Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • RFP: add a new param on civicrm_relationship_get

This forum was archived on 2017-11-26.