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) »
  • Am I losing it?
Pages: [1]

Author Topic: Am I losing it?  (Read 811 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Am I losing it?
October 11, 2010, 01:22:27 pm
I just spotted this

http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviCRM+Public+APIs

Quote
The 'direction' that the APIS are going in is documented here. In general choose to use 'Add' rather than 'Create' and 'Get' rather than 'Search' to future proof your code

I thought that 'Create' was the chosen verb (although I seem to have referred to Add myself enough times)

It is create though isn't it?

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

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: Am I losing it?
October 12, 2010, 05:50:42 am
I thought we settled on:
create
get
update (doing no more than merging parms and current values and then calling create with the id)
delete
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Am I losing it?
October 12, 2010, 10:44:54 am
OK, I updated that wiki page. I have 2 reservations about the Update which are to do with the practicality of implementing it

1) there are quite a few updates we would need to write to make it consistent
2) most existing creates will do update if id is passed in & we can't change this without doing backward compatibility measures.

So, implementing update consistently seems more work letting create do update
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

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: Am I losing it?
October 12, 2010, 10:51:44 am
I am happy with just letting create do update :-) Whatever is quickest.....I just ran into 2 issues during Bristol where the create threw up problems when doing an update. What happened is because it did not merge current values in the DB with the params, it would set any database field not passed as a param to the default value. For example, remove the contact_id_b in the relationship if it was not passed as a parameter in the update. Did you check how this works for the others?
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Am I losing it?
October 12, 2010, 11:38:37 am
Oh yuck - well that is an argument for update or something. I have to say I don't think that is consitent across the API- I don't think I've hit it on contribute
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

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: Am I losing it?
October 12, 2010, 12:04:04 pm
You can see why I thought update would be a nice idea :-) But actually, whatever way is the quickest to do and is then consistent all the way makes me happy. Now for a glass of wine!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Am I losing it?

This forum was archived on 2017-11-26.