From e0ecfd31c4ea538aa31976dbd9dde62eb92e141f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 12 Jul 2018 16:01:12 +0200 Subject: [PATCH] Added a caution note about race conditions in EntityType --- reference/constraints/UniqueEntity.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index 12df4196338..97b430ba5a6 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -109,6 +109,13 @@ your user table: } } +.. caution:: + + This constraint doesn't provide any protection against `race conditions`_. + They may occur when another entity is persisted by an external process after + this validation has passed and before this entity is actually persisted in + the database. + Options ------- @@ -262,3 +269,5 @@ If set to ``false``, only one ``null`` value is allowed - if a second entity also has a ``null`` value, validation would fail. .. include:: /reference/constraints/_payload-option.rst.inc + +.. _`race conditions`: https://en.wikipedia.org/wiki/Race_condition