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

problem #17

Closed
hamzarebaichkaw opened this issue Jun 5, 2017 · 7 comments
Closed

problem #17

hamzarebaichkaw opened this issue Jun 5, 2017 · 7 comments

Comments

@hamzarebaichkaw
Copy link

An exception has been thrown during the rendering of a template ("Notice: Object of class Symfony\Component\Form\FormView could not be converted to int")

@hamzarebaichkaw
Copy link
Author

"exception" => Twig_Error_Runtime {#1601 ▼
-lineno: 3
-name: "StarRatingBundle:Display:ratingDisplay.html.twig"
-rawMessage: "An exception has been thrown during the rendering of a template ("Notice: Object of class Symfony\Component\Form\FormView could not be converted to int")."
-sourcePath: "/var/www/html/MMSS/vendor/blackknight467/star-rating-bundle/blackknight467/StarRatingBundle/Resources/views/Display/ratingDisplay.html.twig"
-sourceCode: """

\n
{% for i in 1..max %}\n
\n
{% endfor %}\n

"""
#message: "An exception has been thrown during the rendering of a template ("Notice: Object of class Symfony\Component\Form\FormView could not be converted to int")."
#code: 0
#file: "/var/www/html/MMSS/vendor/blackknight467/star-rating-bundle/blackknight467/StarRatingBundle/Resources/views/Display/ratingDisplay.html.twig"
#line: 3

@blackknight467
Copy link
Owner

@hamzarebaichkaw
can you post the twig you're using and the value of the variable you're passing to the rating filter?

@hamzarebaichkaw
Copy link
Author

{{ form_start(commentaire, {'action': path('AjoutCommentaire') , 'method': 'POST','class':'comment-form'}) }}

{{ form_widget(commentaire.comment, { 'attr': {'class': 'form-control','cols':'45','rows':'8', 'placeholder': 'Write your comment here...'} }) }}

{{ form_widget(commentaire.rating|rating(5,"fa-3x") ) }}
</p>

Publish

{{ form_end(commentaire) }}

@blackknight467
Copy link
Owner

@hamzarebaichkaw
is "commentaire.rating" a string or an int?

@hamzarebaichkaw
Copy link
Author

int

@blackknight467
Copy link
Owner

blackknight467 commented Jun 5, 2017

@hamzarebaichkaw
oh, you're trying to use a filter in your form. Just remove the rating filter and you should be fine.

{{ form_widget(commentaire.rating) }}

@hamzarebaichkaw
Copy link
Author

@blackknight467
thank you it worked

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

No branches or pull requests

2 participants