Skip to content

Commit

Permalink
hotfix: add x2m data when fetching multiple entries
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Nov 8, 2016
1 parent 78b17a2 commit b0a9000
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions api/core/Directus/Db/TableGateway/RelationalTableGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,16 @@ public function getEntries($params = [])
$this->toManyCallStack = [];
$results = $this->loadManyToOneRelationships($schemaArray, $results);

// =============================================================================
// HOTFIX: Fetching X2M data and Infinite circle loop
// =============================================================================
// Separate alias fields from table schema array
$aliasColumns = $this->filterSchemaAliasFields($schemaArray); // (fmrly $alias_schema)
foreach($results as $key => $result) {
$this->toManyCallStack = [];
$results[$key] = $this->loadToManyRelationships($result, $aliasColumns);
}

/**
* Fetching a set of data
*/
Expand All @@ -756,11 +766,6 @@ public function getEntries($params = [])

list($result) = $results;

// Separate alias fields from table schema array
$alias_fields = $this->filterSchemaAliasFields($schemaArray); // (fmrly $alias_schema)

$result = $this->loadToManyRelationships($result, $alias_fields);

return $result;
}

Expand Down

0 comments on commit b0a9000

Please sign in to comment.