Skip to content

Commit 8d5b7cc

Browse files
committed
fix bug with schema attributes
1 parent c36c1c4 commit 8d5b7cc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/QueryRelationManager.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,12 @@ protected function addFields(string $className, string $joinAs): self
440440
throw new QueryRelationManagerException("class {$className} is not defined");
441441
}
442442

443-
$obj = (new $className());
444443

445-
if(!method_exists($obj, 'getAttributes')) {
446-
throw new QueryRelationManagerException("method {$className}::getAttributes() is not defined");
444+
if(!method_exists($className, 'getTableSchema')) {
445+
throw new QueryRelationManagerException("method {$className}::getTableSchema() is not defined");
447446
}
448447

449-
$fields = array_keys($obj->getAttributes());
448+
$fields = array_keys($className::getTableSchema()->columns);
450449

451450
$this->fieldMatrix[$joinAs] = [];
452451

0 commit comments

Comments
 (0)