Basically the optimistic locking support is almost there. You can add a version field with getter/setter to your entity and you can add it to de/normalization. the only thing missing is to make it required.
a quick fix would be to add a listener that sets the version field to null after ReadListener, but before the DenormalizeListener, so if you dont provide a version, then doctrine will fail to update and throws an optimistic lock exception. Furthermore the lock exception can be set to 400 response code. And you can add a validation constraint to the version to have nice error messages.
Basically the optimistic locking support is almost there. You can add a version field with getter/setter to your entity and you can add it to de/normalization. the only thing missing is to make it required.
a quick fix would be to add a listener that sets the version field to
nullafterReadListener, but before theDenormalizeListener, so if you dont provide a version, then doctrine will fail to update and throws an optimistic lock exception. Furthermore the lock exception can be set to 400 response code. And you can add a validation constraint to the version to have nice error messages.