[], 'join_with' => [], 'orderby' => '', 'attribute_id_producer' => '' ]; } public function query() { return ProducerPriceRange::find()->orderBy('range_begin ASC'); } public function getAmountToBeBilledByTurnover(float $turnover, $format = false) { $amountToBeBilled = 0; $producerPriceRangeArray = ProducerPriceRange::find()->all(); foreach ($producerPriceRangeArray as $priceRange) { if ($turnover >= $priceRange->range_begin && $turnover < $priceRange->range_end) { $amountToBeBilled = $priceRange->price; } } if ($format) { return Price::format($amountToBeBilled, 0); } else { return $amountToBeBilled; } } }