Sugar CRM获得一个bean与一对多关联的关系

时间:2014-03-10 20:08:15

标签: php sugarcrm

这是我的代码:

<?php

        if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
        switch($_SERVER['REQUEST_METHOD']){
            case 'GET': $req = &$_GET; break;
            case 'POST': $req = &$_POST; break;
            default:
        }

        echo ' 0 ';

        $focus = new m_formProcessor();
        $focus->retrieve_by_string_fields(array('name' => $req['formProcessor'] ));

        echo ' 1 ';

        echo $focus->id;


        echo ' 2 ';

        $focus->load_relationship('m_modules');

        echo ' 2.1.2 ';

        $list = array();
        foreach ($focus->m_modules->getBeans() as $m_module) {
            echo ' 2.2 ';
            echo $m_module->target;
        }

        echo ' 3 ';

        echo $focus->module->target;
        echo $focus->modules->target;
        echo $focus->m_modules->target;

        echo ' 4 ';
    ?>

我正在关注此页面上的博客:http://developer.sugarcrm.com/2012/03/23/howto-using-the-bean-instead-of-sql-all-the-time/

但是在foreach中似乎有一个错误,任何建议都会有所帮助。

0 个答案:

没有答案