cakephp3形成无线电控制访问其他实体价值

时间:2017-10-16 08:47:28

标签: php cakephp-3.x

我需要将一些实体值填充到无线电HTML代码中,我看 通过所有文档,但似乎无法找到任何帮助

下面是php代码,

{{entity-> description}}

是我要显示的实体值

$this->Form->setTemplates ( [ 
        'radioContainer' => '{{content}}' 
] );
echo $this->Form->control ( 'OrderShippingMethodId', 
[ 
            'templates' => [                
                'nestingLabel' => '**<p>{{entity->description}}</p>**
              {{input}}{{text}}',               
                'radioWrapper' => '{{label}}'       ],
        'options' => $shippingMethodsRadio,
        'type' => 'radio',
        'label' => false,
        'type' => 'radio',
        'id' => 'OrderShippingMethodId',
        'legend' => false ,
        'escape' => false

] );

它生成以下html代码,&lt; p&gt;&lt; / p&gt;未显示实体描述值

运送

从上面的粗体代码中可以看出,无法读取entity-&gt;描述值 out,似乎是form-&gt;控件可以从中读出的唯一值 实体是文本,价值。无论如何都要访问实体中的其他值

在控制器方法中,填充$ shippingMethodsRadio

$ this-&gt; set(&#39; shippingMethodsRadio&#39; =&gt; $ shippingMethods-&gt; extract(&#39; radio&#39;));

$ shippingMethods,将包含一个实体shippingMethod的集合,我想读取其他值,如实体中的description属性进入无线电控件,在shippingMethod中的radio属性返回一个数组包含值,text,description属性填充无线电控制的实体

谢谢

0 个答案:

没有答案