2010-06-06 56 views
1

我很困惑我的控制器應該有什麼,以及我的方法。Zend Framework-在哪裏調用我的方法去?模型控制器?

具體來說,我有這樣的操作方法:

public function upcomingshowsAction() 
    { 
     $gcal = $this->_validateCalendarConnection(); 
     $uncleanedFeedArray = $this->_getCalendarFeed($gcal); 
     $finishedFeedArray = $this->_cleanFeed($uncleanedFeedArray); 
    $this->view->googleArray = $finishedFeedArray; 

    } 

然後(不正確,我知道),我有我的方法還是在我的控制器的底部。

那麼是什麼我不知道,是在upcomingshowsAction方法這些方法,都應該實際的方法僅僅是一個模型,然後我有這樣的事情:

public function upcomingshowsAction() 
    { 
     $finishedFeedArray = new Application_Model_calendarModelPage(); 
    $this->view->googleArray = $finishedFeedArray; 

    } 

然後什麼像這樣的模型:

class Application_Model_CalendarModelPage 
{ 

     $gcal = $this->_validateCalendarConnection(); 
     $uncleanedFeedArray = $this->_getCalendarFeed($gcal); 
     $finishedFeedArray = $this->_cleanFeed($uncleanedFeedArray); 


    public functions 
    { 
    ... 
    ... 
    ... 
    } 
} 

我在正確的軌道上嗎?

謝謝!

回答

1

第二種方式是走。控制器僅在這裏(主要)從模型獲取一些數據並將其傳遞到視圖。你所有的業務邏輯都應該進入模型。

相關問題