public function create($data)
    {
        $result = parent::create($data);
        if ($result) {
            /* update balances for accounts */
            if (is_array($data)) {
                $data = new Entity($data);
            }
            $value = $data->getValue();
            $creditAccId = $data->getCreditAccId();
            $debitAccId = $data->getDebitAccId();
            $this->repoAccount->updateBalance($creditAccId, 0 + $value);
            $this->repoAccount->updateBalance($debitAccId, 0 - $value);
        }
        return $result;
    }
public function create($data)
    {
        $result = parent::create($data);
        if ($result) {
            /* update balances for accounts */
            if (is_array($data)) {
                $data = new Entity($data);
            }
            $value = $data->getValue();
            $creditAccId = $data->getCreditAccId();
            $debitAccId = $data->getDebitAccId();
            $this->repoAccount->updateBalance($creditAccId, 0 + $value);
            $this->repoAccount->updateBalance($debitAccId, 0 - $value);
        }
        return $result;
    }
public function create ( $ data ) { $ result = parent :: create ( $ data ) ; if ( $ result ) { /* update balances for accounts */ if ( is_array ( $ data ) ) { $ data = new Entity ( $ data ) ; } $ value = $ data -> getValue ( ) ; $ creditAccId = $ data -> getCreditAccId ( ) ; $ debitAccId = $ data -> getDebitAccId ( ) ; $ this -> repoAccount -> updateBalance ( $ creditAccId , 0 + $ value ) ; $ this -> repoAccount -> updateBalance ( $ debitAccId , 0 - $ value ) ; } return $ result ; }
Create transaction and update balances in account table.

@param \Praxigento\Accounting\Repo\Data\Transaction|array $data
@return int
Create transaction and update balances in account table .