简体   繁体   中英

Sonata Admin - boolean field type, label not displayed

I'm creating a Sonata Admin page for an Entity (generated with Symfony CLI).

In this Entity I have 3 textfields and 1 checkbox(boolean). Everthing is well generated except the checkbox. The checkbox is strangly located and there is no label.

In the configureFormFields I defined the checkbox field as it:

->add("online",null, array('required' => false, "label" => "My label"))

And on the Entity I have:

 /**
 * @ORM\Column(name="online", type="boolean", nullable=false)
 */
 private $online;

Here is a screenshot: 没有复选框标签

Is it a known problem? Have you got any solution?

OK I found the solution:

I was using Symfony 2.6.* when I changed to Symfony 2.3 problem was fixed!

So I look in SonataAdmin GitHub issue to found this working solution: https://github.com/sonata-project/SonataAdminBundle/issues/2630

At the end I am in Symfony 2.6 with checkbox label.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM