public function getPrices() { $RPrice = RPrice::find()->where(["id_item" => $this->id_item])->all(); $result = false; foreach ($RPrice as $price) { $result[$price->id_unit] = $price->value; } return $result; }
public function getPrices() { return $this->hasMany(RPrice::className(), ['id_item' => 'id']); }