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

Make "length" filter and "empty" test consider __toString [Twig 1.x] #2420

Closed
wants to merge 16 commits into from

Conversation

mpdude
Copy link
Contributor

@mpdude mpdude commented Mar 10, 2017

Use case: When you have variables in your views that are actually objects but implement __toString, they feel like strings: For example, {{ something }} will make use of that to-string-conversion.

What does not work is

a) {{ something | length }}, because that will only have a meaningful return value for objects implementing \Countable. This interface, however, may have a totally different semantic/purpose for the object in question.

b) {% if something is empty %}, because

empty checks if a variable is an empty string, an empty array, an empty hash, exactly false, or exactly null [http://twig.sensiolabs.org/doc/2.x/tests/empty.html]

... and obviously something !== null in this case.

For template designers, this may be surprising if they don't actually care about the object-or-string difference, they just "use" the variable.

This change tries to address this as it changes the behavior for such objects that have a __toString method and are not \Countable.

Yes, it's a BC break in edge cases:

For a), objects that implement a __toString but not \Countable would previously yield 1 for {{ object | length }}, and now would return the length of the string returned by __toString.

For b), testing (defined) variables that are objects implementing __toString and that return '', the test now is false.

@fabpot
Copy link
Contributor

fabpot commented Mar 10, 2017

LGTM. Can you add some tests and a note in the CHANGELOG file?

@mpdude
Copy link
Contributor Author

mpdude commented Mar 10, 2017

@fabpot done. Hope the tests look like what you expected, otherwise please guide me.

Failing tests on PHP 7 only, seems unrelated.

return mb_strlen($thing, $env->getCharset());
}

if (is_object($thing) && !$thing instanceof \Countable && is_callable(array($thing, '__toString'))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use method_exists() here instead as __toString() must be public and we don't want to return true is a class implements __call().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which means that another test with a class having __call() but no __toString() should be added as well.

@mpdude mpdude changed the title Allow "length" filter to work on objects with a __toString method that are not \Countable [Twig 1.x] Fix "length" filter and "empty" test for objects with a __toString method [Twig 1.x] Mar 15, 2017
@mpdude mpdude changed the title Fix "length" filter and "empty" test for objects with a __toString method [Twig 1.x] Make "length" filter and "empty" test consider __toString [Twig 1.x] Mar 15, 2017
@mpdude
Copy link
Contributor Author

mpdude commented Mar 15, 2017

@fabpot Took care of your feedback, also from #2426 which has been merged into this one.

If ``Countable`` is implemented as well, the return value of the ``count()`` method
takes precedence.

.. versionadded:: 1.33
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabpot Do you have tooling/policy/processes in place to make this read 2.3 when merged into the 2.x branch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do that manually I think

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block should be moved to the top.

@mpdude
Copy link
Contributor Author

mpdude commented Mar 22, 2017

@fabpot Do you think this could make it into the next Twig release?

@fabpot
Copy link
Contributor

fabpot commented Mar 22, 2017

Can you rebase to get rid of the merge commit? I will then review it and make any additional comment before merge and release. Thanks.

Copy link
Contributor

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, ready to be merged after fixes. Thanks.

CHANGELOG Outdated
* 1.33.0 (2017-XX-XX)

* "length" filter now returns string length when applied to an object that does not implement \Countable but provides __toString()
* "empty" test will now consider the return value of the __toString() method for objects implementing __toString() but not \Countable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you wrap each line like done for other items?

If ``Countable`` is implemented as well, the return value of the ``count()`` method
takes precedence.

.. versionadded:: 1.33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do that manually I think

length of the string being returned.

If ``Countable`` is implemented as well, the return value of the ``count()`` method
takes precedence.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this confusing. I prefer the way you documented the other one. Can you change it to read the same as the other one?


.. versionadded:: 1.33

Support for the ``__toString()`` magic method has been added in Twig 1.33.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block should be moved to the top.

If ``Countable`` is implemented as well, the return value of the ``count()`` method
takes precedence.

.. versionadded:: 1.33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block should be moved to the top.

…t are not \Countable

Use case: When you have variables in your views that are actually objects but implement `__toString`, they feel like strings: For example, `{{ something }}` will make use of that to-string-conversion.

What does *not* work is `{{ something | length }}`, because that will only have a meaningful return value for objects implementing `\Countable`. This interface, however, may have a totally different semantic/purpose for the object in question.

For template designers, this may be surprising if they don't actually care about the object-or-string difference, they just "use" the variable.

This change tries to address this as it changes the behavior for  such objects that have a `__toString` method and are *not* `\Countable`.

*Yes*, it's a BC break in an edge case: Objects that implement a `__toString` but not `\Countable` would previously yield `1` for `{{ object | length }}`, and now would return the length of the string returned by `__toString`.
Both instanceof and method_exists() seem to handle non-object value just fine
@mpdude mpdude force-pushed the length-for-tostring-objects branch from 60c21a8 to 9dbed98 Compare March 22, 2017 14:25
@mpdude
Copy link
Contributor Author

mpdude commented Mar 22, 2017

@fabpot rebased, docs fixed as you suggested

@fabpot
Copy link
Contributor

fabpot commented Mar 22, 2017

Thank you @mpdude.

@fabpot fabpot closed this Mar 22, 2017
fabpot added a commit that referenced this pull request Mar 22, 2017
…ng [Twig 1.x] (mpdude)

This PR was squashed before being merged into the 1.x branch (closes #2420).

Discussion
----------

Make "length" filter and "empty" test consider __toString [Twig 1.x]

Use case: When you have variables in your views that are actually objects but implement `__toString`, they feel like strings: For example, `{{ something }}` will make use of that to-string-conversion.

What does *not* work is

**a)** `{{ something | length }}`, because that will only have a meaningful return value for objects implementing `\Countable`. This interface, however, may have a totally different semantic/purpose for the object in question.

**b)** `{% if something is empty %}`, because

> empty checks if a variable is an empty string, an empty array, an empty hash, exactly false, or exactly null  `[http://twig.sensiolabs.org/doc/2.x/tests/empty.html]`

... and obviously `something !== null` in this case.

For template designers, this may be surprising if they don't actually care about the object-or-string difference, they just "use" the variable.

This change tries to address this as it changes the behavior for  such objects that have a `__toString` method and are *not* `\Countable`.

*Yes*, it's a BC break in edge cases:

For a), objects that implement a `__toString` but not `\Countable` would previously yield `1` for `{{ object | length }}`, and now would return the length of the string returned by `__toString`.

For b), testing (defined) variables that are objects implementing  `__toString` and that return `''`,  the test now is `false`.

Commits
-------

f5193e9 Make "length" filter and "empty" test consider __toString [Twig 1.x]
@mpdude mpdude deleted the length-for-tostring-objects branch March 22, 2017 14:54
@jordisala1991
Copy link

jordisala1991 commented Mar 24, 2017

Not sure if it is BC or we are misusing toString method, but after updating to twig 2.3.0 our application crashed on this code.

let's say you have an entity with a __toString method that not always returns a string.

When you do something like: {{ entity|default(another_object) }} we get an error because our __toString does not always return a string (Because entity is not yet saved).

Is this related to this PR? @fabpot @mpdude . If we downgrade to 2.2.0 it works.

[1] Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Method Clinic\WebBundle\Entity\Disease::__toString() must return a string value").
   at n/a
       in /home/ubuntu/vendor/sonata-project/admin-bundle/Resources/views/CRUD/action_buttons.html.twig line 12

   at Twig_Template->displayWithErrorHandling(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables), '_preview' => null, '_form' => '            

   A LOT OF HTML with {{ object|default }} at some point

', '_show' => null, '_list_table' => null, '_list_filters' => null, '_tab_menu' => '', '_content' => null, '_title' => '            Crear
   ', '_breadcrumb' => null), array('html_attributes' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_html_attributes'), 'meta_tags' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_meta_tags'), 'stylesheets' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_stylesheets'), 'javascripts' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_javascripts'), 'sonata_javascript_config' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_javascript_config'), 'sonata_javascript_pool' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_javascript_pool'), 'sonata_head_title' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_head_title'), 'body_attributes' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_body_attributes'), 'sonata_header' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_header'), 'sonata_header_noscript_warning' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_header_noscript_warning'), 'logo' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_logo'), 'sonata_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_nav'), 'sonata_breadcrumb' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_breadcrumb'), 'sonata_top_nav_menu' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_top_nav_menu'), 'sonata_top_nav_menu_add_block' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_top_nav_menu_add_block'), 'sonata_top_nav_menu_user_block' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_top_nav_menu_user_block'), 'sonata_wrapper' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_wrapper'), 'sonata_left_side' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_left_side'), 'sonata_side_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_side_nav'), 'sonata_sidebar_search' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_sidebar_search'), 'side_bar_before_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_side_bar_before_nav'), 'side_bar_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_side_bar_nav'), 'side_bar_after_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_side_bar_after_nav'), 'side_bar_after_nav_content' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_side_bar_after_nav_content'), 'sonata_page_content' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_page_content'), 'sonata_page_content_header' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_page_content_header'), 'sonata_page_content_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_page_content_nav'), 'tab_menu_navbar_header' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_tab_menu_navbar_header'), 'sonata_admin_content_actions_wrappers' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_admin_content_actions_wrappers'), 'sonata_admin_content' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_admin_content'), 'notice' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_notice'), 'bootlint' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_bootlint'), 'sonata_form_action_url' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_action_url'), 'sonata_form_attributes' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_attributes'), 'sonata_pre_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_pre_fieldsets'), 'sonata_tab_content' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_tab_content'), 'sonata_post_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_post_fieldsets'), 'formactions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_formactions'), 'sonata_form_actions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_actions'), 'parentForm' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_form'), 'title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_title'), 'navbar_title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_navbar_title'), 'actions' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_actions'), 'tab_menu' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_tab_menu'), 'form' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_form')))
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 389

   at Twig_Template->displayWithErrorHandling(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array('html_attributes' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_html_attributes'), 'meta_tags' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_meta_tags'), 'stylesheets' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_stylesheets'), 'javascripts' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_javascripts'), 'sonata_javascript_config' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_javascript_config'), 'sonata_javascript_pool' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_javascript_pool'), 'sonata_head_title' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_head_title'), 'body_attributes' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_body_attributes'), 'sonata_header' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_header'), 'sonata_header_noscript_warning' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_header_noscript_warning'), 'logo' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_logo'), 'sonata_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_nav'), 'sonata_breadcrumb' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_breadcrumb'), 'sonata_top_nav_menu' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_top_nav_menu'), 'sonata_top_nav_menu_add_block' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_top_nav_menu_add_block'), 'sonata_top_nav_menu_user_block' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_top_nav_menu_user_block'), 'sonata_wrapper' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_wrapper'), 'sonata_left_side' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_left_side'), 'sonata_side_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_side_nav'), 'sonata_sidebar_search' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_sidebar_search'), 'side_bar_before_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_side_bar_before_nav'), 'side_bar_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_side_bar_nav'), 'side_bar_after_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_side_bar_after_nav'), 'side_bar_after_nav_content' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_side_bar_after_nav_content'), 'sonata_page_content' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_page_content'), 'sonata_page_content_header' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_page_content_header'), 'sonata_page_content_nav' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_page_content_nav'), 'tab_menu_navbar_header' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_tab_menu_navbar_header'), 'sonata_admin_content_actions_wrappers' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_admin_content_actions_wrappers'), 'sonata_admin_content' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_sonata_admin_content'), 'notice' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_notice'), 'bootlint' => array(object(__TwigTemplate_316031af297d2d80ba6dbfac5ab6f0be2c44232dd3da81b18f2ec4bfb5adecb6), 'block_bootlint'), 'sonata_form_action_url' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_action_url'), 'sonata_form_attributes' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_attributes'), 'sonata_pre_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_pre_fieldsets'), 'sonata_tab_content' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_tab_content'), 'sonata_post_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_post_fieldsets'), 'formactions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_formactions'), 'sonata_form_actions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_actions'), 'parentForm' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_form'), 'title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_title'), 'navbar_title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_navbar_title'), 'actions' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_actions'), 'tab_menu' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_tab_menu'), 'form' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_form')))
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 366

   at Twig_Template->display(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array('stylesheets' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_stylesheets'), 'side_bar_after_nav_content' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_side_bar_after_nav_content'), 'sonata_form_action_url' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_action_url'), 'sonata_form_attributes' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_attributes'), 'sonata_pre_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_pre_fieldsets'), 'sonata_tab_content' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_tab_content'), 'sonata_post_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_post_fieldsets'), 'formactions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_formactions'), 'sonata_form_actions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_actions'), 'parentForm' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_form'), 'title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_title'), 'navbar_title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_navbar_title'), 'actions' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_actions'), 'tab_menu' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_tab_menu'), 'form' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_form')))
       in /home/ubuntu/cache/dev/twig/6c/6cc6dbebb68d0a261dec1fee4460accf5cf146b8f36a5167a35f47d929baa792.php line 28

   at __TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44->doDisplay(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array('stylesheets' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_stylesheets'), 'side_bar_after_nav_content' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_side_bar_after_nav_content'), 'sonata_form_action_url' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_action_url'), 'sonata_form_attributes' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_attributes'), 'sonata_pre_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_pre_fieldsets'), 'sonata_tab_content' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_tab_content'), 'sonata_post_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_post_fieldsets'), 'formactions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_formactions'), 'sonata_form_actions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_actions'), 'parentForm' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_form'), 'title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_title'), 'navbar_title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_navbar_title'), 'actions' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_actions'), 'tab_menu' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_tab_menu'), 'form' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_form')))
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 389

   at Twig_Template->displayWithErrorHandling(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array('stylesheets' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_stylesheets'), 'side_bar_after_nav_content' => array(object(__TwigTemplate_750fdc3acaab66440bef23c93ad0f5f676d50df8c6fd6a34bad19a9ed39e0c44), 'block_side_bar_after_nav_content'), 'sonata_form_action_url' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_action_url'), 'sonata_form_attributes' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_attributes'), 'sonata_pre_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_pre_fieldsets'), 'sonata_tab_content' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_tab_content'), 'sonata_post_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_post_fieldsets'), 'formactions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_formactions'), 'sonata_form_actions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_actions'), 'parentForm' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_form'), 'title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_title'), 'navbar_title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_navbar_title'), 'actions' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_actions'), 'tab_menu' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_tab_menu'), 'form' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_form')))
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 366

   at Twig_Template->display(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array('sonata_form_action_url' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_action_url'), 'sonata_form_attributes' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_attributes'), 'sonata_pre_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_pre_fieldsets'), 'sonata_tab_content' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_tab_content'), 'sonata_post_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_post_fieldsets'), 'formactions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_formactions'), 'sonata_form_actions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_actions'), 'parentForm' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_form'), 'title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_title'), 'navbar_title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_navbar_title'), 'actions' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_actions'), 'tab_menu' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_tab_menu'), 'form' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_form')))
       in /home/ubuntu/cache/dev/twig/54/54ed32fff170109e81b454c9f3169d33ef8f9ddee5f12e80ee979dd7fc161376.php line 48

   at __TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a->doDisplay(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array('sonata_form_action_url' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_action_url'), 'sonata_form_attributes' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_attributes'), 'sonata_pre_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_pre_fieldsets'), 'sonata_tab_content' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_tab_content'), 'sonata_post_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_post_fieldsets'), 'formactions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_formactions'), 'sonata_form_actions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_actions'), 'parentForm' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_form'), 'title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_title'), 'navbar_title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_navbar_title'), 'actions' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_actions'), 'tab_menu' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_tab_menu'), 'form' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_form')))
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 389

   at Twig_Template->displayWithErrorHandling(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array('sonata_form_action_url' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_action_url'), 'sonata_form_attributes' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_attributes'), 'sonata_pre_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_pre_fieldsets'), 'sonata_tab_content' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_tab_content'), 'sonata_post_fieldsets' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_post_fieldsets'), 'formactions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_formactions'), 'sonata_form_actions' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_sonata_form_actions'), 'parentForm' => array(object(__TwigTemplate_0876c2e01149f32baba7ec91c23b4120250fcb8fb8d8acfc62f38ac0f3744271), 'block_form'), 'title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_title'), 'navbar_title' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_navbar_title'), 'actions' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_actions'), 'tab_menu' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_tab_menu'), 'form' => array(object(__TwigTemplate_c11c174d0c95d34b1248177419479f1ab03b2cd7c0eee7b6f650d811a2ca9f0a), 'block_form')))
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 366

   at Twig_Template->display(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array())
       in /home/ubuntu/cache/dev/twig/7d/7d1b8a2a8a29f0dcd4fee072ed1572efd4663e56c3f32099317a13e9248fc08e.php line 26

   at __TwigTemplate_128e694960109ef2a437a3012cf13014cdd22a3b18794081e5d8a41636c9ac95->doDisplay(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array())
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 389

   at Twig_Template->displayWithErrorHandling(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_admin' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_user' => object(GlobalVariables)), array())
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 366

   at Twig_Template->display(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool)))
       in /home/ubuntu/vendor/twig/twig/lib/Twig/Template.php line 374

   at Twig_Template->render(array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool)))
       in /home/ubuntu/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php line 50

   at Symfony\Bridge\Twig\TwigEngine->render('SonataAdminBundle:CRUD:edit.html.twig', array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool)))
       in /home/ubuntu/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/TwigEngine.php line 72

   at Symfony\Bundle\TwigBundle\TwigEngine->render('SonataAdminBundle:CRUD:edit.html.twig', array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool)))
       in /home/ubuntu/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/TwigEngine.php line 99

   at Symfony\Bundle\TwigBundle\TwigEngine->renderResponse('SonataAdminBundle:CRUD:edit.html.twig', array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool)), object(Response))
       in /home/ubuntu/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php line 185

   at Symfony\Bundle\FrameworkBundle\Controller\Controller->render('SonataAdminBundle:CRUD:edit.html.twig', array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool)), null)
       in /home/ubuntu/vendor/sonata-project/admin-bundle/Controller/CRUDController.php line 77

   at Sonata\AdminBundle\Controller\CRUDController->render('SonataAdminBundle:CRUD:edit.html.twig', array('action' => 'create', 'form' => object(FormView), 'object' => object(Disease), 'breadcrumbs_builder' => object(BreadcrumbsBuilder), 'admin' => object(DiseaseAdmin), 'base_template' => 'sonata/standard_layout.html.twig', 'admin_pool' => object(Pool)), null)
       in /home/ubuntu/vendor/sonata-project/admin-bundle/Controller/CRUDController.php line 569

   at Sonata\AdminBundle\Controller\CRUDController->createAction()
       in  line 

   at call_user_func_array(array(object(CRUDController), 'createAction'), array())
       in /home/ubuntu/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 144

   at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
       in /home/ubuntu/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 64

   at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
       in /home/ubuntu/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php line 69

   at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
       in /home/ubuntu/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 185

   at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
       in /vagrant/web/app_dev.php line 13

Thanks for your time.

@mpdude
Copy link
Contributor Author

mpdude commented Mar 24, 2017

The default filter was not touched by this PR, so if it is the one causing trouble I'd suspect the problem comes from elsewhere...?

@fabpot
Copy link
Contributor

fabpot commented Mar 24, 2017

In PHP? __toString() must always return a string, even null is not accepted.

@stof
Copy link
Member

stof commented Mar 24, 2017

@mpdude default relies on the empty test, and so it has been touched by the PR changing the empty test

@jordisala1991
Copy link

In PHP? __toString() must always return a string, even null is not accepted.

My question is, should default filter call __toString() on an object?

I mean, if the object is not null, it is not empty, no need to check more things. That's why I asked, I wasn't sure if I am missing something there.

@mpdude
Copy link
Contributor Author

mpdude commented Mar 24, 2017

What is your code supposed to do? If object is defined, use the value from its __toString method, and if it is not, use __toString from another object?

@jordisala1991
Copy link

jordisala1991 commented Mar 24, 2017

If object is defined, use object, otherwise use another_object. On my use case, I send this result to another filter, so IMO no __toString() should be called by default.

@mpdude
Copy link
Contributor Author

mpdude commented Mar 24, 2017

I can make a PR to make the default filter work like before – only check if the value is not the empty string, null etc.

But consider {{ object | default('foo') }}: When object has a __toString() method and can be used as {{ object }} to make use of that, template designers probably expect the default to kick in whenever the string is empty. That's just like {{ somevar | default('foo') }} would work for a plain value in somevar.

I don't see how this could work "both" ways.

@fabpot?

@anyt
Copy link

anyt commented Dec 14, 2017

We used default function in data attributes formatted to json like modelAttr: product|default({}) and this pr also broke our application because product has __toString method.
Imho, for the default function it's a BC break.

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

Successfully merging this pull request may close these issues.

5 participants