Search code examples
symfonyprestashop

The parameter has a dependency on a non-existent parameter


I have a password in parameters in services.yaml, for example "xxx%xxxxx%xx" and when i want to do GetParameter it returns me only "xxxxx" and error 500

parameters:
     api_passwd: "x%xxxxx%xxx"

enter image description here


Solution

  • First off, avoid using images in your questions. Just copy/paste the relevant portions of the error into your code.

    Secondly it sort of looks like you are testing in production mode? You should have gotten a completely different error message. Make yourself a simple console command for testing these sorts of things.

    In any event, Symfony treats % as a rather special character. In general, avoid using % in your yaml values. Never really noticed it myself which is why I am actually posting an answer. The workaround is to double up the % character. Basically escaping it.

    parameters:
        api_passwd: "x%%xxxxx%%xxx"
    

    The extra % characters will be stripped out when you retrieve the value.