Skip to content

Conversation

@adrienbrault
Copy link

No description provided.

@bwoodmansee
Copy link

👍

@thewilkybarkid
Copy link
Contributor

Definitely right for production, but what happens during development? IIRC Symfony recognises whether the container has changed rather than automatically compiling it on every request, so presumably it won't recognise whether client.json has changed? That could lead to some confusion. Could someone test this?

@adrienbrault
Copy link
Author

Good point. This should work:

use Symfony\Component\Config\Resource\FileResource;

$serviceDescriptionPath = __DIR__ . '/../Resources/config/client.json';
$container->addResource(new FileResource($serviceDescriptionPath));
$container->setParameter(
    'path.to.my.service_description.file',
    json_decode(file_get_contents($serviceDescriptionPath), true)
);

@thewilkybarkid
Copy link
Contributor

Just done a quick test and it seems like Symfony automatically monitors the Resources/config folder, so we should only suggest adding it if it's stored elsewhere.

This also means that we can just use the constructor rather than the factory method in the service config. We rename the parameter too (to, say, my.service_description).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants