Skip to content

Commit 5e68514

Browse files
committed
Store hydrator in local var
1 parent 43773fe commit 5e68514

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Models/ModelRelationship.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ private function hydrate( $value ) {
120120
return null;
121121
}
122122

123+
$hydrator = $this->definition->getHydrateWith();
124+
123125
if ( is_array( $value ) ) {
124-
return array_values( array_map( fn( $item ) => $this->definition->getHydrateWith()( $item ), $value ) );
126+
return array_values( array_map( fn( $item ) => $hydrator( $item ), $value ) );
125127
}
126128

127-
return $this->definition->getHydrateWith()( $value );
129+
return $hydrator( $value );
128130
}
129131

130132
/**

0 commit comments

Comments
 (0)