lotgd / core

Core functionality for Legend of the Green Dragon, a text-based RPG game.
GNU Affero General Public License v3.0
152 stars 15 forks source link

Failing to register module must not result in partially installed module #95

Closed Vassyli closed 7 years ago

Vassyli commented 7 years ago

Currently, if an error occurs during registering of a module, the module still is partially installed (it gets a database entry in the table module), while not saving the parts added in onRegister. This makes manual intervention necessary.

austenmc commented 7 years ago

Yeah I looked briefly into transactions for this but it didnt seem like doctrine supported nested transactions. I can look again later.

Vassyli commented 7 years ago

Is there any reason for flushing (->save()) the module entity before running onRegister except for getting an id? I think there might be 2 possible solutions to this:

  1. switch to manually generated id for this entity so everything stays 1 transaction
  2. catch exceptions (probably any exceptions as well as errors) and delete module entity again.