From 15d926ebe460ff109e04ad665bd18a903077224c Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Mon, 26 Jun 2017 00:05:22 +0800 Subject: [PATCH] Fix casts store for update --- src/DataMapper/DataMapper.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/DataMapper/DataMapper.php b/src/DataMapper/DataMapper.php index bac247745..f22e20d6e 100644 --- a/src/DataMapper/DataMapper.php +++ b/src/DataMapper/DataMapper.php @@ -318,6 +318,12 @@ protected function doUpdate($dataset, array $condFields, $updateNulls = false) $data = $this->bindData($data); } + // If data is entity object, try cast values first. + if ($data instanceof Entity) + { + $data = $this->castForStore($data); + } + $entity = new Entity($this->getFields($this->table), $data); if ($updateNulls)