Skip to content

Commit

Permalink
fix ReflectionClass getValue
Browse files Browse the repository at this point in the history
  • Loading branch information
bepsvpt committed Nov 21, 2022
1 parent abf875f commit 61ed5cd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Select/SelectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ public static function getSelectColumns(Node $definitionNode, array $fieldSelect

if (method_exists($model, $relationName)) {
if (AppVersion::below(5.7)) {
$relation = new \ReflectionClass($model->{$relationName}());

while ('HasOneOrMany' !== $relation->getShortName()) {
$relation = $relation->getParentClass();
}

$localKey = $relation->getProperty('localKey');
$relation = $model->{$relationName}();
$rc = new \ReflectionClass($model->{$relationName}());
$localKey = $rc->getProperty('localKey');
$localKey->setAccessible(true);
array_push($selectColumns, $localKey->getValue($relation));
} else {
Expand Down

0 comments on commit 61ed5cd

Please sign in to comment.