2
votes

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: No checkbox label

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

1
I have tried this, but I cannot reproduce your problem. The checkbox (and its label) renders fine in my case. Have you cleared your cache, updated vendors (composer update), etc.? Are you running in dev environment with error reporting on? Did you inspect the HTML source code to see if there's anything odd?Nic Wortel
And, of course, did you override any of the Sonata Admin templates?Nic Wortel
Fixed (see my answer), thank you for your replyCyrilleGuimezanes

1 Answers

3
votes

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.