$this->id PriceAlias db - , getPrices() , .
, $this->id != null $this->isNewRecord == false, , null, .
1: , ,
Prices::find()>with('prices') WHERE ... IN (...),
hasMany addWhere, ActiveRecord. :
$this->hasMany(Prices::className(), ['aliasId' => 'id'])
, getPrices() .
, ? $q->sql = $query->getRawSql();, $q->sql SELECT * FROM (SELECT * FROM Prices WHERE aliasId = :aliasId order by id desc) p1 group by p1.currency?
2: . - Prices::find()->with() sql, , , .
find()->with() , .