2013-07-10 20 views
0
<?php 

class Excellence_Manager_Adminhtml_ManagerController extends Mage_Adminhtml_Controller_action 
{ 

    public function customerAction(){ 
     $this->loadLayout(); 
     $this->getLayout()->getBlock('customer.grid') 
     ->setCustomers($this->getRequest()->getPost('customers', null)); 
     $this->renderLayout(); 
    } 

我正在關注this grid serializer tute。我無法理解這套客戶來自哪裏?這個方法在管理控制器(Grid Serializer)中做什麼?

即使在其他tutes中,我看到了setClent(),setDog()等等。但是哪裏得到或它不是來自數據庫。不是我認爲的佈局。請幫忙謝謝。

<manager_adminhtml_manager_customer> 
    <block type="core/text_list" name="root" output="toHtml"> 
     <block type="manager/adminhtml_manager_edit_tab_grid" name="customer.grid"/> 
     <block type="adminhtml/widget_grid_serializer" name="grid_serializer"> 
      <reference name="grid_serializer"> 
       <action method="initSerializerBlock"> 
        <grid_block_name>customer.grid</grid_block_name> 
        <data_callback>getSelectedCustomers</data_callback> 
        <hidden_input_name>links[customers]</hidden_input_name> 
        <reload_param_name>customers</reload_param_name> 
       </action> 
       <action method="addColumnInputName"> 
        <input_name>position</input_name> 
       </action> 
      </reference> 
     </block> 
    </block> 

我發現它不是從hidden_​​input_name或reload_param_name。

回答

0
__set() is run when writing data to inaccessible properties. 

__get() is utilized for reading data from inaccessible properties. 

Magento實現了所謂的「魔術方法」來設置對象中的數據。 他們實施__set__get這是調用,當沒有方法爲例如。找到setCustomers(),並用這些方法去做setData('customers', "YOUR_VALUE");

相關問題