Fix #251: dbal driver - safe queue creation by Ocramius · Pull Request #252 · bernardphp/bernard

@Ocramius

Since we don't have UPSERT support in DBAL (and sadly will not be in it for a while), this PR fixes #251 by providing graceful handling of queue creation.

  1. operations are executed in a transaction
  2. only unique constraint exceptions are caught (very important! if the DB dies, that's not something we can ignore)
  3. avoid causing duplicate key issues, when possible
…eady existing repositories
… with constraint violation exceptions

@Ocramius

@Ocramius

Ocramius


$driver = new DoctrineDriver($connection);

$driver->createQueue('foo');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: no assertions provided here. The assertion is self::once() on the insert call.

@henrikbjorn

any idea why the tests are failing?

@Ocramius

@danydev

@henrikbjorn what can I do to speed up the merge of this one? As explained on #275 this prevents Bernard to work on PostgreSQL 9.5.x

@henrikbjorn

Im currently sick so ill look at it, when my head clears up.

@henrikbjorn

@Ocramius Thanks for this, sorry for me being so slow getting back and merging this.

@Ocramius

@danydev

@ruudk

Thanks! You guys are awesome :D

@danydev

@henrikbjorn sorry to disturb you again, but I'm wondering if you intentionally merged it on 0.x branch. If it is intentional, what's the process to have it merged back on master?

@henrikbjorn

@danydev you are a life saver, didn't even notice. I have merged it into the master branch as well.

@danydev

@danydev

@Ocramius Ocramius deleted the fix/#251-dbal-queue-safe-queue-creation branch

December 19, 2016 22:54

@asprega

Hi @henrikbjorn ! We could really use this fix on master, even better if in a new tagged release. Are you able to merge this to master or are there any issues?