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) »
  • About how to add the new API entity: ActivityContact
Pages: [1]

Author Topic: About how to add the new API entity: ActivityContact  (Read 840 times)

capo

  • I post occasionally
  • **
  • Posts: 108
  • Karma: 5
About how to add the new API entity: ActivityContact
March 31, 2014, 03:52:28 pm
I was just revisiting a post about how to retrieve contacts assigned/targeted/who-created an activity (*), and I realized that the API entity ActivityContact doesn't still exists.

I've just wrote a first draft that seems to work fine. You can see it attached to this post (I changed the extension from .php to .txt so I could attach it).

The question is that I still don't know very well how should a Pull Request be. I mean, to add this ActivityContact.php to the core, we should write before some tests, isn't it?

Are there any other step I should follow, before sending the PR? Like creating an issue, or something like that?

Thanks!

(*) - http://forum.civicrm.org/index.php/topic,31718.msg135996.html#msg135996

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: About how to add the new API entity: ActivityContact
March 31, 2014, 04:10:30 pm
Awesome. thx!

Indeed, you need to create an issue (so you can reference it in the PR) and write some tests.

One you have your test environement set up (you need a civi installed from git and kill a goat and offer its heart to the phpunits god, check the details on the wiki, it might have been streamlined recently ;)

You can take this one as an example for simple tests:
tests/phpunit/api/v3/PhoneTest.php
and this one on how to create an activity so you can then test your new entity
ActivityTest.php

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

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: About how to add the new API entity: ActivityContact
March 31, 2014, 11:38:29 pm
Cool capo! Good luck testing and goat killing :-)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

jaapjansma

  • I post frequently
  • ***
  • Posts: 247
  • Karma: 9
    • CiviCoop
  • CiviCRM version: 4.4.2
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.4
Re: About how to add the new API entity: ActivityContact
April 01, 2014, 12:33:09 am
Cool! I have just used the return parameters of the activity api to retrieve the target contact return[activity_target_contact] and return[activity_assignee_contact]. But a seperate api is welcome.
Developer at Edeveloper / CiviCoop

capo

  • I post occasionally
  • **
  • Posts: 108
  • Karma: 5
Re: About how to add the new API entity: ActivityContact
April 01, 2014, 02:44:59 am
Ok, issue created: https://issues.civicrm.org/jira/browse/CRM-14414
I'll write the tests as soon as possible.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • About how to add the new API entity: ActivityContact

This forum was archived on 2017-11-26.