/** * {@inheritdoc} */ protected function addFilesystemResource($path, FilesystemResource $resource) { // Read children before attaching the resource to this repository $children = $resource->listChildren(); parent::addFilesystemResource($path, $resource); // Recursively add all child resources $basePath = '/' === $path ? $path : $path . '/'; foreach ($children as $name => $child) { $this->addFilesystemResource($basePath . $name, $child); } }