Skip to content

Commit 7686c80

Browse files
Merge branch '3.4'
* 3.4: bumped Symfony version to 3.4.0 updated VERSION for 3.4.0-BETA1 updated CHANGELOG for 3.4.0-BETA1 Do not process bindings in AbstractRecursivePass don't bind scalar values to controller method arguments Add extra autowiring aliases adding AdapterInterface alias for cache.app Adding a new debug:autowiring command [HttpFoundation] Make sessions secure and lazy [Routing] Ensure uniqueness without repeated check [Console] Sync ConsoleLogger::interpolate with the one in HttpKernel
2 parents d599b5e + f37405c commit 7686c80

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

RouteCollection.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ public function addCollection(RouteCollection $collection)
128128
$this->routes[$name] = $route;
129129
}
130130

131-
$this->resources = array_merge($this->resources, $collection->getResources());
131+
foreach ($collection->getResources() as $resource) {
132+
$this->addResource($resource);
133+
}
132134
}
133135

134136
/**
@@ -262,16 +264,21 @@ public function setMethods($methods)
262264
*/
263265
public function getResources()
264266
{
265-
return array_unique($this->resources);
267+
return array_values($this->resources);
266268
}
267269

268270
/**
269-
* Adds a resource for this collection.
271+
* Adds a resource for this collection. If the resource already exists
272+
* it is not added.
270273
*
271274
* @param ResourceInterface $resource A resource instance
272275
*/
273276
public function addResource(ResourceInterface $resource)
274277
{
275-
$this->resources[] = $resource;
278+
$key = (string) $resource;
279+
280+
if (!isset($this->resources[$key])) {
281+
$this->resources[$key] = $resource;
282+
}
276283
}
277284
}

0 commit comments

Comments
 (0)