/** * @param string $subscriber_id * @return DbMessageQuery $this */ public function withSubscriber($subscriber_id = null) { if ($subscriber_id === null) { $modelClass = $this->modelClass; $t = $modelClass::tableName(); $this->andWhere("{$t}.subscription_id IS NULL"); } else { $this->innerJoinWith('subscription'); $this->andWhere(DbSubscription::tableName() . '.subscriber_id=:subscriber_id', [':subscriber_id' => $subscriber_id]); } return $this; }