Skip to content

Commit

Permalink
Handle circular references in DunglasApiParser. Close nelmio#678.
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Feb 4, 2016
1 parent 5d9c47b commit abb100b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Parser/DunglasApiParser.php
Expand Up @@ -181,7 +181,7 @@ private function parseAttribute(ResourceInterface $resource, AttributeMetadataIn

$data['actualType'] = DataTypes::MODEL;
$data['subType'] = $class;
$data['children'] = $this->parseClass($resource, $class, $io);
$data['children'] = $resource->getEntityClass() === $class ? [] : $this->parseClass($resource, $class, $io);

return $data;
}
Expand Down
18 changes: 9 additions & 9 deletions Tests/Fixtures/app/config/dunglas_api.yml
@@ -1,22 +1,22 @@
doctrine:
dbal:
driver: "pdo_sqlite"
path: "%kernel.cache_dir%/db.sqlite"
charset: "UTF8"
driver: 'pdo_sqlite'
path: '%kernel.cache_dir%/db.sqlite'
charset: 'UTF8'

orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_generate_proxy_classes: '%kernel.debug%'
auto_mapping: true

framework:
router: { resource: "%kernel.root_dir%/config/dunglas_api_routing.yml" }
router: { resource: '%kernel.root_dir%/config/dunglas_api_routing.yml' }

dunglas_api:
title: API
description: Test API

services:
dunglas_json_ld_api.popo:
parent: "api.resource"
arguments: [ "Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\Popo" ]
tags: [ { name: "api.resource" } ]
dunglas_api.popo:
parent: 'api.resource'
arguments: [ 'Nelmio\ApiDocBundle\Tests\Fixtures\Model\Popo' ]
tags: [ { name: 'api.resource' } ]

0 comments on commit abb100b

Please sign in to comment.