Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

How access to form.parent when the form has child called parent? #18882

Copy link
Copy link
Closed
@rafrsr

Description

@rafrsr
Issue body actions

How can know if a form has a parent or not, in a view?

The fast answer is:

{{ form.parent }}

but if the form has a child called parent the above statement always return a result, even when they do not have a real parent.

then the only way to know if has a real parent is something like:

{% set hasParent = (form.parent is not null and (not form.offsetExists('parent') or form.parent != form.offsetGet('parent'))) %}

I'm missing something?

a method hasParent() is needed in the FormView to avoid the \ArrayAccess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureFormGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.