Skip to content

Incorrect documentation for caching #4970

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

Closed
Elendev opened this issue Feb 7, 2015 · 4 comments
Closed

Incorrect documentation for caching #4970

Elendev opened this issue Feb 7, 2015 · 4 comments

Comments

@Elendev
Copy link

Elendev commented Feb 7, 2015

The last example of the Expression language caching section (https://github.com/symfony/symfony-docs/blob/2.6/components/expression_language/caching.rst) doesn't work :

$expression = new SerializedParsedExpression(
        serialize($language->parse('1 + 4', array()))
    );

The SerializedParsedExpression constructor requires a $nodes parameters.
I'm not really sure on how to do it the right way.

@stof
Copy link
Member

stof commented Feb 10, 2015

The first argument should be the expression itself, which is missing here. I sent a PR fixing it

@Elendev
Copy link
Author

Elendev commented Feb 11, 2015

So, if I understand correctly : if I want to optimize an expression evaluation by serializing it, for example in database, I have to keep both the serialized parsed expression and the expression to be able to use it with SerializedParsedExpression ?

wouterj added a commit that referenced this issue Feb 14, 2015
This PR was merged into the 2.5 branch.

Discussion
----------

Fix the example using SerializedParsedExpression

Closes #4970

Commits
-------

b51bdbe Fix the example using SerializedParsedExpression
@xabbuh xabbuh closed this as completed Feb 17, 2015
@stof
Copy link
Member

stof commented Feb 17, 2015

@Elendev yes, because the expression object must be able to give the original expression when being casted as string.

@Elendev
Copy link
Author

Elendev commented Feb 17, 2015

@stof ok I understand, thank you for the explanation

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

4 participants