/**
  * Return list of relations for current model
  * @return array
  */
 public static function getRelations()
 {
     $old = parent::getRelations();
     $old['parent'] = [DbRelations::BELONGS_TO, '\\mpf\\modules\\forum\\models\\ForumReplyThird', 'reply_id'];
     $old['replies'] = [DbRelations::HAS_MANY, '\\mpf\\modules\\forum\\models\\ForumReplyFifth', 'reply_id'];
     $old['myVote'] = DbRelation::hasOne(ForumReplyVote::className())->columnsEqual('id', 'reply_id')->hasValue('level', 4)->hasValue('user_id', WebApp::get()->user()->isConnected() ? WebApp::get()->user()->id : 0);
     return $old;
 }
Esempio n. 2
0
 /**
  * Return list of relations for current model
  * @return array
  */
 public static function getRelations()
 {
     return ['author' => [DbRelations::BELONGS_TO, '\\app\\models\\User', 'user_id'], 'thread' => [DbRelations::BELONGS_TO, '\\mpf\\modules\\forum\\models\\ForumThread', 'thread_id'], 'sectionAuthor' => DbRelation::belongsTo(ForumUser2Section::className(), 'user_id')->hasAttributeValue('section_id', 'currentSection'), 'editor' => [DbRelations::BELONGS_TO, '\\app\\models\\User', 'edit_user_id'], 'deletedBy' => [DbRelations::BELONGS_TO, '\\app\\models\\User', 'deleted_user_id'], 'authorGroup' => [DbRelations::BELONGS_TO, '\\mpf\\modules\\forum\\models\\ForumUserGroup', 'user_group_id'], 'replies' => [DbRelations::HAS_MANY, '\\mpf\\modules\\forum\\models\\ForumReplySecond', 'reply_id'], 'myVote' => DbRelation::hasOne(ForumReplyVote::className())->columnsEqual('id', 'reply_id')->hasValue('level', 1)->hasValue('user_id', WebApp::get()->user()->isConnected() ? WebApp::get()->user()->id : 0)];
 }