/** * @return \hipanel\modules\finance\models\Calculation[] * @throws UnprocessableEntityHttpException */ public function execute() { $data = $this->collectData(); if (empty($data)) { return []; } try { $rows = Calculation::perform('CalcValue', $data, true); } catch (\Exception $e) { throw new UnprocessableEntityHttpException('Failed to calculate value: ' . $e->getMessage(), 0, $e); } $this->calculations = $this->createCalculations($rows); return $this->calculations; }