src/Neutrino/Repositories/Repository.php
protected function transactionCall(array $values, $method)
    {
        if (empty($values)) {
            return true;
        }

        /** @var \Phalcon\Mvc\Model\Transaction $tx */
        $tx = $this->getDI()->getShared(Transaction\Manager::class)->get();

        try {
            $this->messages = [];

            foreach ($values as $item) {

                $item->setTransaction($tx);

                if ($item->$method() === false) {
                    $this->messages = array_merge($this->messages, $item->getMessages());
                }
            }

            if (!empty($this->messages)) {
                throw new TransactionException(
                    get_class(Arr::fetch($values, 0)) . ':' . $method .
                    ': failed. Show ' . static::class . '::getMessages().'
                );
            }

            if ($tx->commit() === false) {
                throw new TransactionException('Commit failed.');
            }

            return true;
        } catch (\Exception $e) {
            $tx->rollback();

            $this->messages[] = $e->getMessage();
            if (!is_null($messages = $tx->getMessages())) {
                $this->messages = array_merge($this->messages, $messages);
            }

            return false;
        }
    }
protected function transactionCall(array $values, $method)
    {
        if (empty($values)) {
            return true;
        }

        /** @var \Phalcon\Mvc\Model\Transaction $tx */
        $tx = $this->getDI()->getShared(Transaction\Manager::class)->get();

        try {
            $this->messages = [];

            foreach ($values as $item) {

                $item->setTransaction($tx);

                if ($item->$method() === false) {
                    $this->messages = array_merge($this->messages, $item->getMessages());
                }
            }

            if (!empty($this->messages)) {
                throw new TransactionException(
                    get_class(Arr::fetch($values, 0)) . ':' . $method .
                    ': failed. Show ' . static::class . '::getMessages().'
                );
            }

            if ($tx->commit() === false) {
                throw new TransactionException('Commit failed.');
            }

            return true;
        } catch (\Exception $e) {
            $tx->rollback();

            $this->messages[] = $e->getMessage();
            if (!is_null($messages = $tx->getMessages())) {
                $this->messages = array_merge($this->messages, $messages);
            }

            return false;
        }
    }
@param \Neutrino\Model[]|\Phalcon\Mvc\Model[] $values
@param string                                 $method

@return bool