private function getRandomQuote() { return $this->_quotes[array_rand($this->_quotes, 1)]; } public function actionIndex() { $this->render('index', array( 'quote'=>$this->randomQuote )); } public function actionGetQuote() { $this->renderPartial('_quote', array( 'quote'=>$this->randomQuote )); }
this code generates an error:
Quote
QuoteController and its behaviors do not have a method or closure named "getrandomQuote".
Why am I not able to do this in this code? The only way to get it to work would be to change randomQuote to 'quote'=>$this->getRandomQuote()