File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -5025,6 +5025,19 @@ public function createOrUpdateDocumentsWithIncrease(
50255025 throw new StructureException ($ validator ->getDescription ());
50265026 }
50275027
5028+ if (!$ old ->isEmpty ()) {
5029+ // Check if document was updated after the request timestamp
5030+ try {
5031+ $ oldUpdatedAt = new \DateTime ($ old ->getUpdatedAt ());
5032+ } catch (Exception $ e ) {
5033+ throw new DatabaseException ($ e ->getMessage (), $ e ->getCode (), $ e );
5034+ }
5035+
5036+ if (!\is_null ($ this ->timestamp ) && $ oldUpdatedAt > $ this ->timestamp ) {
5037+ throw new ConflictException ('Document was updated after the request timestamp ' );
5038+ }
5039+ }
5040+
50285041 if ($ this ->resolveRelationships ) {
50295042 $ document = $ this ->silent (fn () => $ this ->createDocumentRelationships ($ collection , $ document ));
50305043 }
You can’t perform that action at this time.
0 commit comments