private function insert() { if (!$this->fresh) { return; } RowCreator::beginTransaction(); try { if ($this->beforeInsert() === false) { RowCreator::rollback(); return false; } $this->relation_ship->save(); $Entity = get_called_class(); (new Mapper())->selectTable($Entity::getTableName())->insert($this->data); $this->relation_ship->saveBridge(); RowCreator::commitTransaction(); } catch (\Exception $ex) { RowCreator::rollback(); $this->handleException($ex); return false; } return true; }