public function getCardsCount() { return count(DeckHasCards::find()->where(['=', 'deck_id', $this->id])->all()); }
/** * @return \yii\db\ActiveQuery */ public function getDeckHasCards() { return $this->hasMany(DeckHasCards::className(), ['card_id' => 'id']); }