@@ -146,7 +146,7 @@ public function fill(?array $data = null)
146146 * __get() magic method so will have any casts, etc applied to them.
147147 *
148148 * @param bool $onlyChanged If true, only return values that have changed since object creation
149- * @param bool $cast If true, properties will be casted .
149+ * @param bool $cast If true, properties will be cast .
150150 * @param bool $recursive If true, inner entities will be casted as array as well.
151151 */
152152 public function toArray (bool $ onlyChanged = false , bool $ cast = true , bool $ recursive = false ): array
@@ -256,6 +256,8 @@ public function hasChanged(?string $key = null): bool
256256 return $ this ->original !== $ this ->attributes ;
257257 }
258258
259+ $ key = $ this ->mapProperty ($ key );
260+
259261 // Key doesn't exist in either
260262 if (! array_key_exists ($ key , $ this ->original ) && ! array_key_exists ($ key , $ this ->attributes )) {
261263 return false ;
@@ -287,7 +289,7 @@ public function setAttributes(array $data)
287289 * Checks the datamap to see if this property name is being mapped,
288290 * and returns the db column name, if any, or the original property name.
289291 *
290- * @return string
292+ * @return string db column name
291293 */
292294 protected function mapProperty (string $ key )
293295 {
@@ -480,7 +482,7 @@ public function __get(string $key)
480482 // Convert to CamelCase for the method
481483 $ method = 'get ' . str_replace (' ' , '' , ucwords (str_replace (['- ' , '_ ' ], ' ' , $ key )));
482484
483- // if a set * method exists for this key,
485+ // if a get * method exists for this key,
484486 // use that method to insert this value.
485487 if (method_exists ($ this , $ method )) {
486488 $ result = $ this ->{$ method }();
0 commit comments