Results 1 to 8 of 8

Thread: what are sugar beans - in plain english please?

  1. #1
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default what are sugar beans - in plain english please?

    is there a plain english guide to what a sugarbean is and why its used by sugarcrm?

    why is it advantageous to generate an object, and then query it - over just using normal php to query a dbase directly?

  2. #2
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: what are sugar beans - in plain english please?

    It's the base programming class for all record types in the Sugar codebase.

    From this Wiki article...
    SugarBean is the base class for all business objects in Sugar. It implements the primary functionality needed for manipulating business objects: create, retrieve, update, delete. It allows for searching and retrieving list of records. It allows for retrieving related objects (e.g. contacts related to a specific account).

    In the current implementation, there can only be one bean per folder. Naming convention has the bean name be the same as the module and folder name. All bean names should be singular (e.g. Contact). The primary table name for a bean should be plural (e.g. contacts).

    The SugarBean handles everything based on the Module Definitions.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  3. #3
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default Re: what are sugar beans - in plain english please?

    how does a programmer interact with a bean in order to retrieve data from the database?
    the above docs are too high level and really dont explain how a php coder can interact with bean data.

    and why use beans in a php app? why not simple function calls?

  4. #4
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: what are sugar beans - in plain english please?

    Naturally that depends on what you are trying to do. The best place to start is by looking at the tutorials found on http://developers.sugarcrm.com.

    I suggest starting with the Business Logic Hooks tutorial. Also you will find the Sugar Developer's Manual helpful.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  5. #5
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: what are sugar beans - in plain english please?

    Quote Originally Posted by netron
    and why use beans in a php app? why not simple function calls?
    A Sugar Bean is a standard class structure that abstracts away database and presentation complexities for you. One key component is that by using the SugarBean functions, all of the bean events (before_save, on_retrieve, etc) will be fired off. These mechanisms allow you to write upgrade safe code customizations. See the previous post for pointers to the proper tutorials.

    Clint
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  6. #6
    JVWay is offline Sugar Community Member
    Join Date
    Sep 2007
    Location
    Corvallis, Oregon
    Posts
    452

    Default Re: what are sugar beans - in plain english please?

    Clint,
    Thanks for the posts. That manual says vers. 4.5. How applicable is it for 5.0? Did much change in the underpinnings.

    Thanks,
    JW
    Jerry Way
    Business Process Administrator

    Sugar 6.1.4 Professional
    (Testing 6.1.2)
    LAMP on Centos 5
    PHP 5
    MySQL 5
    Apache 2.2

  7. #7
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: what are sugar beans - in plain english please?

    There are certainly some differences between 4.5.1 and 5.0.0. The UI presentation layer was completely refactored in 5.0. However all of the data layer and controller aspects around the Sugar Bean are the same.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  8. #8
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default Re: what are sugar beans - in plain english please?

    thanks clint. that explains a lot.

    i kind of knew that something like that existed in sugar (by poking around and looking at the classes being declared and used at runtime)

    i wish i knew earlier before i did my non-upgrade safe "customisations".

    sugar really does need to emphasise this a bit more in the documentation - or maybe marketing - targetted directly at php hackers, as we do have a tendency to just dive in and hack the code, without realising that there's a bigger picture.

    a "ruby on rails" style of evangelising so that php coders "get the message" about what sugar is perhaps needed.

    thanks for the links again. very educational.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 2009-12-02, 04:04 PM
  2. Sugar Upgradability -> Needs community input
    By lvangool in forum Feature Requests
    Replies: 7
    Last Post: 2007-03-09, 07:39 PM
  3. Sugar Open Source 3.5.1e Available for Download
    By clint in forum Announcements
    Replies: 0
    Last Post: 2005-12-10, 06:29 AM
  4. Who is working on which translations?
    By clint in forum Translators
    Replies: 5
    Last Post: 2005-08-26, 02:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •