Dear All,
Today as Yii 1.0.8 released, I upgraded mine from Yii 1.0.7. And errors show:
FlashMessage does not have a method named "run".
What is weird, it was fine before I upgraded. So I decided to make sure, and degrade it again to Yii 1.0.7, and it runs OK again without errors or exceptions. But when I upgrade to 1.0.8 again, it throws error again.
FlashMessage is a portlet of which displays application messages and determine correct css style to users, for example:
FlashMessage extends Portlet which extends CWidget. Here is the code to Portlet.php:
<?php
abstract class Portlet extends CWidget
{
public $title = '';
public $showTitle = true;
public $published = true;
public function init() {
}
public function run()
{
if ($this->published)
{
$this->renderContent();
// render the portlet ending frame
}
}
/**
* Child Classes from Portlet must override this method to render its content
* @method renderContent
* @abstract
*/
abstract protected function renderContent();
}
And the FlashMessage.php is as simple as below:
<?php
class FlashMessage extends Portlet
{
public $message = '';
public $type = 'success'; //success || error || warning || info
public function init()
{
parent::init();
}
/**
*
* Child Classes from Portlet must override this method to render its content
* @method renderContent
*/
protected function renderContent()
{
if(Yii::app()->user->hasFlash('success'))
{
$this->message = Yii::app()->user->getFlash('success');
$this->type = 'success';
}
else if (Yii::app()->user->hasFlash('error'))
{
$this->message = Yii::app()->user->getFlash('error');
$this->type = 'error';
}
else if (Yii::app()->user->hasFlash('info'))
{
$this->message = Yii::app()->user->getFlash('info');
$this->type = 'info';
}
else if (Yii::app()->user->hasFlash('warning'))
{
$this->message = Yii::app()->user->getFlash('warning');
$this->type = 'warning';
}
$this->render('_flashMessage');
}
}
And finaly, the view of the FlashMessage:
<?php if (isset($this->message) && $this->message != "") { ?>
<div class="message <?php echo $this->type; ?>">
<?php echo $this->message; ?>
</div>
<?php } ?>
I don’t know but maybe it has something to do on the way I imported the models and components ? In the config/main.php is all the imports happen in my application:
<?php
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.ext.*',
'application.helpers.*',
'application.vendors.*'
)
So, please help on this issue, because I really do not know what has happened ? Why it displays error when I run my application on Yii version 1.0.8 ?
For now, I have degraded again to Yii 1.0.7 as my application runs Stable on the version.
Thank you in advanced!