From 870dff0fd4d1e68667b709b4938545008d20e04b Mon Sep 17 00:00:00 2001 From: Ruud Boon Date: Fri, 20 Sep 2019 17:48:04 +0200 Subject: [PATCH] Use write connection on create to prevent replica lag. Fix #14256 --- phalcon/Mvc/Model.zep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phalcon/Mvc/Model.zep b/phalcon/Mvc/Model.zep index 57cd17cb0bf..ebdafe79374 100644 --- a/phalcon/Mvc/Model.zep +++ b/phalcon/Mvc/Model.zep @@ -955,10 +955,10 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let metaData = this->getModelsMetaData(); /** - * Get the current connection + * Get the current connection use write to prevent replica lag * If the record already exists we must throw an exception */ - if this->_exists(metaData, this->getReadConnection()) { + if this->_exists(metaData, this->getWriteConnection()) { let this->errorMessages = [ new Message( "Record cannot be created because it already exists",