File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,12 @@ protected function prepareValue()
198
198
} else {
199
199
$ value = null ;
200
200
if ($ data instanceof ActiveRecordInterface ) {
201
- $ value = $ data ->getAttribute ($ this ->name );
201
+ $ relation = $ data ->getRelation ($ this ->name , false );
202
+ if ($ relation !== null ) {
203
+ $ value = $ relation ;
204
+ } else {
205
+ $ value = $ data ->getAttribute ($ this ->name );
206
+ }
202
207
} elseif ($ data instanceof Model) {
203
208
$ value = $ data ->{$ this ->name };
204
209
} elseif (is_array ($ data )) {
@@ -207,7 +212,7 @@ protected function prepareValue()
207
212
$ value = $ data ;
208
213
}
209
214
210
- if ($ this ->isEmpty ( $ value ) && $ this ->defaultValue !== null ) {
215
+ if ($ this ->defaultValue !== null && $ this ->isEmpty ( $ value ) ) {
211
216
$ value = $ this ->defaultValue ;
212
217
}
213
218
}
You can’t perform that action at this time.
0 commit comments