Skip to content

Instantly share code, notes, and snippets.

@mmoreram
Created January 4, 2015 01:08
Show Gist options
  • Save mmoreram/150d0806e4f8b3b5d8df to your computer and use it in GitHub Desktop.
Save mmoreram/150d0806e4f8b3b5d8df to your computer and use it in GitHub Desktop.
ExpressionLanguage
#
# Factory for Product entities
#
elcodi.core.product.factory.product:
class: %elcodi.core.product.factory.product.class%
parent: elcodi.core.currency.factory.abstract.purchasable
calls:
- [setEntityNamespace, ["%elcodi.core.product.entity.product.class%"]]
- [setUseStock, [@=service("elcodi.configuration_manager").getParameter('use_stock','product')]]
@mmoreram
Copy link
Author

mmoreram commented Jan 4, 2015

This definition is not working because of getParameter("...", "...")
If I work with one parameter... it works.

The error:

Unexpected characters ()]]) at line 15 (near "- [setUseStock, [@=service("elcodi.configuration_manager").getParameter('use_stock','product')]]").

@stof
Copy link

stof commented Jan 4, 2015

@mmoreram your exception is not coming from the ExpressionLanguage at all. It is a YAML parse exception (look at the exception name, which is missing in your comment). This is because the , marks the end of the array value in Yaml, leaving 'product') to be parsed as the next value, which parses a quoted string and breaks on the closing parenthesis.
To be able to use a comma in the Yaml string, you need to use the quoted syntax, not the unquoted one.

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