kpg9
kpg9

Reputation: 91

What does $bean stand for and can I get SQL data in a field in SugarCRM?

What does $bean stand for in this code:

<?php
    // prevents directly accessing this file from a web browser
    if (!defined('sugarEntry') || !sugarEntry)
        die('Not A Valid Entry Point');

    class Process {

        function process(&$bean, $event) {
            // calculate item profit
            $bean->t_profit_c = ($bean->t_sale_price_c - $bean->t_item_cost_c);

            // calculate sale profit
            if (!empty($bean->t_qty_sold_c)) {
                $bean->t_sale_profit_c = ($bean->t_qty_sold_c * $bean->t_profit_c);
            }
        }
    }
?> 

which I found here

And can I use SQL queries in code like this to get other module's field's content to a field in an other?

Upvotes: 0

Views: 1244

Answers (1)

the_pete
the_pete

Reputation: 822

The $bean is an object, or set of objects used by SugarCRM to allow the user to access database information quickly and easily. Working with them should be pretty easy:

how to using the bean instead of sql all the time

Sugar_Developer

In your instance, the &$bean is an object, passed by reference that holds all the attributes of the item you gave it in step 3 of your link.

Upvotes: 3

Related Questions