Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional Data and localized provider call, parse error #956

Closed
sylvaincombes opened this issue Oct 1, 2018 · 2 comments
Closed

Optional Data and localized provider call, parse error #956

sylvaincombes opened this issue Oct 1, 2018 · 2 comments

Comments

@sylvaincombes
Copy link

Hi, thank you for your project

When using optional data with localized syntax, I face a situation with a parse error :

App\Entity\Registration:
  en_{1..10}:
    address2: '50%? <en_US:streetAddress()>'
    ...

I guess it's the : from the <locale:provider()> ?

Here is command line output :

2018-10-01T11:12:20+02:00 [error] Error thrown while running command "hautelook:fixtures:load --env=test -q". Message: "An error occurred while denormalizing the fixture "en_{1..10}" (App\Entity\Registration): Invalid token "50%? <aliceTokenizedFunction(FUNCTION_START__en_US:streetAddress__IDENTITY_OR_FUNCTION_END)>" found."

In TolerantFixtureDenormalizer.php line 68:
                                                                                                                                                                                                                 
  An error occurred while denormalizing the fixture "en_{1..10}" (App\Entity\Registration): Invalid token "50%? <aliceTokenizedFunction(FUNCTION_START__en_US:streetAddress__IDENTITY_OR_FUNCTION_END)>" found.  
                                                                                                                                                                                                                 

In InvalidArgumentExceptionFactory.php line 125:
                                                                                                                       
  Invalid token "50%? <aliceTokenizedFunction(FUNCTION_START__en_US:streetAddress__IDENTITY_OR_FUNCTION_END)>" found.  

Have you got a solution for this situation, or maybe I missed something ?

Thanks

@theofidry
Copy link
Member

the syntax should work so I would say it's a limitation of the current lexer/parser which can be solved in 3 ways:

  • use a faker provider as a workaround: you can handle the percentage of chances there as well
  • add a failing test case to nelmio/alice and try to solve it, I would recommend to look at Lexer and ParserIntegrationTestCase
  • help with the real fix: [Needs help] Replace in-house lexer by HoaCompiler #712

@theofidry
Copy link
Member

Closing as the real fix IMO is #712 at that point

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

No branches or pull requests

2 participants