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) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • New Entity Discussion
Pages: [1]

Author Topic: New Entity Discussion  (Read 540 times)

ktatgenhorst

  • I’m new here
  • *
  • Posts: 14
  • Karma: 1
  • CiviCRM version: 4.7.4
  • CMS version: 4.3
  • MySQL version: 5.6
  • PHP version: 5.5
New Entity Discussion
April 10, 2016, 11:54:39 am
A couple years back when I started using Civi for political activities. I wanted to get states as an entity and even counties... I have learned much better since then.The state really only exists in reference to groups or organizations, so it's simply an organization with some type of relationship. Got it.

However, being in the political arena most of my organizations have something that I do now view as a type of entity with which they do have specific relationships (even across organizations)
Bills, proposal, legislation etc...

The SunLight Foundation API (which Jon Long has an extension using) makes populating a political database with that info a possibility.

The distinct attributes required to be added to it (in lieu of contact attributes) as well as the attributes to be limited from it seem to (in my mind) suggest an entity.

However, saying "bill" is an entity would then be short sighted because there are many related "entities" that might then be desired. So, as I try to distill it down in my mind. I ultimately arrive at "product of"

All of this speculation though, is born of personal experience with a couple instances of CiviCRM and a little book/video knowledge. Without adding an entity, what would be a good way to handle this and what are the ramifications of creating an entity type?

I posted this in general forums as I believe that this is as much a user/admin question as a developer/implementer question.

Thank you,

Karl
Karl Tatgenhorst

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: New Entity Discussion
April 10, 2016, 02:48:54 pm
Karl,

First, welcome to the CiviCRM Providers' Association!

Second - adding an entity is pretty doable via an extension.  CiviDiscount is a good example of this.  Generally speaking, you need to define your schema (via xml/SQL), and add an API file.  The API code is very clever, and if all you need is basic CRUD functions, you can almost copy/paste from another entity's API file.

That's the easy part.  The harder part is creating a UI.  You'll need to create template pages and PHP for every Smarty-based screen, or the AngularJS equivalents.  While it would be easy for CiviCRM to provide a web UI for creating generic entities, it wouldn't be super-helpful because the real work is in deciding how you want it to relate to your other entities.

If your UI needs are minimal though, an entity is a good way to go!  If not, and you're using Drupal, consider using a content type.  I'm currently working on a project where I want to pre-fill values via JavaScript on a form - but I need a place to store the pre-fill "templates".  I may use an entity, but I'm also likely to create a Drupal content type and expose it as JSON using the Feeds module.
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

ktatgenhorst

  • I’m new here
  • *
  • Posts: 14
  • Karma: 1
  • CiviCRM version: 4.7.4
  • CMS version: 4.3
  • MySQL version: 5.6
  • PHP version: 5.5
Re: New Entity Discussion
April 10, 2016, 04:36:58 pm
Thank you Jon. I will look at how this can fit into my workflow at the moment. There are other areas in Civi which might be a better use of my available time for now. I think I want to talk to you about your Electoral API and extending it a bit based on some uses I have for the SunLight API.

Thanks
Karl Tatgenhorst

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • New Entity Discussion

This forum was archived on 2017-11-26.