Question

I need to customize how field in collection is drawn.

I have entity A:

class A {
    ...
    /**
     * @ORM\OneToOne(targetEntity="B", cascade={"persist"})
     * @ORM\JoinColumn(name="b_id", referencedColumnName="id")
     */
    private $b;
    ...
}

and entity B:

class B {
    ...
    /**
     * @var array
     *
     * @ORM\Column(name="cs", type="array", nullable=true)
     */
    private $cs;
    ...
}

I have form types:

class AType {
    ...
    ->add(
        'b',
        new BType(),
        array(
            'label' => false
        )
    )
    ...
}

class BType {
    ...
    ->add(
        "cs",
        "collection",
        array(
            "type" => "hidden",
            'label' => false,
            'cascade_validation' => true,
            'allow_add' => true,
            'allow_delete' => true,
            'data' => array(1,2,3),
        )
    ...
}

Now, what I need is to customize how items in cs are drawn. I googled a bit and try few options what to put into my form theme:

{% block _NAME_ %}
{% endblock %}

with NAME

_a_b_cs_widget
_b_cs_widget
_cs_widget
_atype_b_cs_widget
_atype_btype_cs_widget
_btype_cs_widget

and few others, now have worked. Could someone please help me with this?

Thanks

Was it helpful?

Solution

Correct is:

_a_b_cs_entry_widget
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top