Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 0bfb162

Browse files
committed
Merge pull request #13 from symfony-cmf/fix-resource-handler
Fix some bugs in ResourceHandler
2 parents 577f373 + c53986e commit 0bfb162

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

Serializer/Jms/Handler/ResourceHandler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,15 @@ private function doSerializeResource(Resource $resource, $depth = 0)
8686

8787
$data['path'] = $resource->getPath();
8888
$data['repository_path'] = $resource->getRepositoryPath();
89-
$children = $resource->listChildren();
9089

9190
$enhancers = $this->enhancerRegistry->getEnhancers($repositoryAlias);
9291

9392
$children = array();
94-
foreach ($resource->listChildren() as $name => $resource) {
93+
foreach ($resource->listChildren() as $name => $childResource) {
9594
$children[$name] = array();
9695

97-
if ($depth < 1) {
98-
$children[$name] = $this->doSerializeResource($resource, $depth + 1);
96+
if ($depth < 2) {
97+
$children[$name] = $this->doSerializeResource($childResource, $depth + 1);
9998
}
10099
}
101100
$data['children'] = $children;

Tests/Features/resource_api_phpcr.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Feature: PHPCR resource repository
77
Given the test application has the following configuration:
88
"""
99
cmf_resource:
10-
repository:
11-
doctrine_phpcr:
12-
phpcr_repo:
13-
basepath: /tests/cmf/articles
10+
repositories:
11+
phpcr_repo:
12+
type: doctrine_phpcr
13+
basepath: /tests/cmf/articles
1414
1515
cmf_resource_rest:
1616
enhancer_map:

Tests/Features/resource_api_phpcr_odm.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Feature: PHPCR-ODM resource repository
77
Given the test application has the following configuration:
88
"""
99
cmf_resource:
10-
repository:
11-
doctrine_phpcr_odm:
12-
phpcrodm_repo:
13-
basepath: /tests/cmf/articles
10+
repositories:
11+
phpcrodm_repo:
12+
type: doctrine_phpcr_odm
13+
basepath: /tests/cmf/articles
1414
1515
cmf_resource_rest:
1616
payload_alias_map:

0 commit comments

Comments
 (0)