Sugarcrm 在视图类中访问bean
嗨,我对SugarCRM还是一个新手,我正试图了解sugars的MVC 我正在制作一个模块,它没有自己的SugarBean,而是需要和Contacts Bean和Quotes Bean交互 下面是我的示例代码 我的问题是如何从view.searchengineer.php文件中的controller.php访问$contact_bean和$quote_bean,以便在加载记录后从它们调用信息 controller.phpSugarcrm 在视图类中访问bean,sugarcrm,Sugarcrm,嗨,我对SugarCRM还是一个新手,我正试图了解sugars的MVC 我正在制作一个模块,它没有自己的SugarBean,而是需要和Contacts Bean和Quotes Bean交互 下面是我的示例代码 我的问题是如何从view.searchengineer.php文件中的controller.php访问$contact_bean和$quote_bean,以便在加载记录后从它们调用信息 controller.php Class PCP_TasksController extends Sug
Class PCP_TasksController extends SugarController
{
function action_search_engineers()
{
// Get Contacts ID
$contact_id = $_GET['Contact_id'];
//Load Contacts Bean and pull Record
$contact_bean = New Contact();
$contact_bean->retrieve($contact_id );
//Get Quote ID
$quote_id = $_GET['Quote_id'];
//Load Quotes Module and pull record
$quote_bean = New AOS_Quotes();
$quote_bean->retrieve($quote_id );
$this->view = 'SearchEngineer';
}
}
views/view.searchengineer.php
class PCP_tasksViewSearchengineer extends SugarView
{
function display() {
Echo "The Contact Name is ";
Echo "The Quote Ref is ";
}
}
我只是将相同的代码直接放在视图中。我是否需要使用$this->view\u object\u map Arrai我认为MVC的目的是将常规逻辑从视图逻辑中分离出来。同意,但MVC模型的实现方式不在您的控制范围之内。在这种情况下,您可以通过简单地将其移到控制器上使其工作,也可以尝试将其插入控制器中使其工作,同时可能引入更多可能的故障点。对于SugarCRM,您需要定制的越少越好。