/** * @param $item * * @throws \Exception */ public function flush(DoplioDbTable $item) { try { $this->table->getConnection()->transaction(function () use($item) { $this->flushItem($item); }); } catch (\Exception $e) { throw new \Exception($e->getMessage()); } }
/** * @throws \Exception */ public function flush() { $this->table->getConnection()->transaction(function () { /** @var DoplioDbTable $item */ foreach ($this->persistanceQueue as $item) { $item->save(); $this->flushDependencies($item); } }); $this->persistanceQueue = []; }