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)