Пример #1
14
 /**
  * @return array relational rules.
  */
 public function relations()
 {
     // NOTE: you may need to adjust the relation name and the related
     // class name for the relations automatically generated below.
     $relations = array('candidate' => array(self::BELONGS_TO, 'Candidate', 'candidate_id'), 'election' => array(self::BELONGS_TO, 'Election', 'election_id'));
     Rate::applyRelations($relations, $this);
     Comment::applyRelations($relations, $this);
     return $relations;
 }
Пример #2
0
 /**
  * @return array relational rules.
  */
 public function relations()
 {
     // NOTE: you may need to adjust the relation name and the related
     // class name for the relations automatically generated below.
     $relations = array('election' => array(self::BELONGS_TO, 'Election', 'election_id'), 'profile' => array(self::BELONGS_TO, 'Profile', 'user_id'), 'votes' => array(self::HAS_MANY, 'Vote', 'candidate_id'), 'acceptedVotesCount' => array(self::STAT, 'Vote', 'candidate_id', 'condition' => 'status = ' . Vote::STATUS_PASSED));
     Rate::applyRelations($relations, $this);
     Comment::applyRelations($relations, $this);
     return $relations;
 }