Fatal error: Call to a member function getClassName() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/comp/protected/modules/voting/widgets/AVoteButtons.php on line 153
My view
<?php Yii::app()->getModule('AVotingModule');
$this->widget('application.modules.voting.widgets.AVoteButtons', array(
'model'=>$model,
));
My widget AVoteButtons.php
/**
* Gets the upvote button for this votable model.
* @return string the HTML for the upvote button
*/
public function getUpvoteButton() {
$htmlOptions = array("class" => $this->upvoteClass);
$htmlOptions['id'] = $this->getId()."-upvote";
$label = $this->upvoteLabel;
if ($this->model->userHasVoted && $this->model->userVote->score == 1) {
if (!isset($htmlOptions['class'])) {
$htmlOptions['class'] = "";
}
$htmlOptions['class'] .= " active";
$label = $this->upvotedLabel;
}
return CHtml::link($label, array("/voting/vote/up", "ownerModel" => $this->model->asa("AVotable")->getClassName(), "ownerId" => $this->model->asa("AVotable")->getId()),$htmlOptions);
}
components/AVotable.php
/**
* Gets the id of the object being moderated.
* @return integer the id of the object being moderated.
*/
public function getId() {
return $this->owner->primaryKey;
}
/**
* Gets the name of the class that is being moderated.
* @return string the owner model class name
*/
public function getClassName() {
return get_class($this->owner);
}

Help













