PHP User::className Examples

PHP User::className - 18 examples found. These are the top rated real world PHP examples of User::className extracted from open source projects. You can rate examples to help us improve the quality of examples.
 /**
  * @param int $boardId
  * @return User[]
  */
 public function getUsers($boardId = null)
 {
     return $this->hasMany(User::className(), ['id' => 'user_id'])->viaTable('cp_users_board_rights', ['board_rights_id' => 'id'], function ($query) use($boardId) {
         if ($boardId != null && is_numeric($boardId)) {
             $query->andWhere(['board_id' => $boardId]);
         }
     });
 }
Example #2
0
 public function testHasHandlers()
 {
     $this->assertFalse(Event::hasHandlers(Post::className(), 'save'));
     $this->assertFalse(Event::hasHandlers(ActiveRecord::className(), 'save'));
     Event::on(Post::className(), 'save', function ($event) {
         $this->counter += 1;
     });
     $this->assertTrue(Event::hasHandlers(Post::className(), 'save'));
     $this->assertFalse(Event::hasHandlers(ActiveRecord::className(), 'save'));
     $this->assertFalse(Event::hasHandlers(User::className(), 'save'));
     Event::on(ActiveRecord::className(), 'save', function ($event) {
         $this->counter += 1;
     });
     $this->assertTrue(Event::hasHandlers(User::className(), 'save'));
     $this->assertTrue(Event::hasHandlers(ActiveRecord::className(), 'save'));
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCreatedBy()
 {
     return $this->hasOne(User::className(), ['id' => 'created_by']);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     $user = User::buildNoInitModel();
     return $this->hasOne(User::className(), [$user->guidAttribute => $this->createdByAttribute]);
 }
Example #5
0
 /**
  * @return \yii\db\ActiveRelation
  */
 public function getAuthor()
 {
     return $this->hasOne(User::className(), ['id' => 'author_id']);
 }
Example #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOwner0()
 {
     return $this->hasOne(User::className(), ['id' => 'owner']);
 }
Example #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAuthors()
 {
     return $this->hasOne(User::className(), ['ID' => 'userId']);
     //bizdeki bir kayıt 1 kayıta denk geliyor ilişkiler
 }
Example #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdUser()
 {
     return $this->hasOne(User::className(), ['id' => 'id_user']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(User::className(), ['email' => 'to'])->andWhere(['scope' => User::SCOPE_FRONTEND]);
 }
Example #10
0
 /**
  * @inheritdoc
  */
 public function getContentContainerTypes()
 {
     return [User::className()];
 }
Example #11
0
 /**
  * @return User - who submitted the form
  */
 public function getUser()
 {
     return $this->hasOne(User::className(), ['id' => 'submittedBy']);
 }
Example #12
0
 public function attachUserClass()
 {
     $this->userClass = User::className();
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getExecutor()
 {
     return $this->hasOne(User::className(), ['id' => 'executor']);
 }
Example #14
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEditor()
 {
     return $this->hasOne(User::className(), ['id' => 'editor_id']);
 }
Example #15
0
 /**
  * Returns all linked AuditData instances
  * @return AuditData[]
  */
 public function getUser()
 {
     return static::hasOne(User::className(), ['user_id' => 'id']);
 }
Example #16
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRequesterUser()
 {
     return $this->hasOne(User::className(), ['id' => 'request_user_id']);
 }
Example #17
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(User::className(), ['id' => 'user_id']);
 }
Example #18
0
 /**
  * @return Profile|null Profile user
  */
 public function getUser()
 {
     return $this->hasOne(User::className(), ['id' => 'user_id'])->inverseOf('profile');
 }