This commit is contained in:
mcndave committed 2021-10-21 19:32:12 +00:00
commit e4767f7c09
11 files changed
+178 -55

No files matched your search

+4 -3
View File
@@ -102,7 +102,7 @@ class RelationBuilder
protected function applyFilter(Repository $repository, string $name) : Repository
{
foreach($this->filters ?? [] as $filter) {
$repository = call_user_func_array([ $this->entity, $filter->method ], [ $repository, $name ]);
$repository = call_user_func_array([ $this->entity, $filter->method ], [ $repository, $name, false ]);
}
return $repository;
@@ -154,7 +154,8 @@ class RelationBuilder
$name = strtolower($name);
foreach($data ?: $this->entity->entityLoadedDataset as $key => $value) {
if ( $key === "{$name}\$collection" ) {
if ( $key === sprintf(static::SUBQUERY_FIELD_SUFFIX, strtolower($name)) ) {
if ($value) {
if ( null === ( $dataset = \json_decode($value, true) ) ) {
throw new \Exception(sprintf("JSON error '%s' from '%s'", \json_last_error_msg(), $value));
@@ -166,7 +167,7 @@ class RelationBuilder
return $entity::entityCollection();
}
}
elseif ( substr($key, 0, $len ) === "{$name}\$" ) {
elseif ( substr($key, 0, $len ) === sprintf(static::JOIN_FIELD_SEPARATOR, strtolower($name)) ) {
$vars[substr($key, $len)] = $value;
}
}