public function changeState(RlcAssignmentState $newState) { // Save the new state's name, catching any exceptions $this->state = $newState->getStateName(); try { $this->save(); } catch (Exception $e) { throw $e; } // If we made it this far, then do the onEnter stuff $newState->onEnter(); }