relez
relez

Reputation: 790

Easyadmin is not recognizing boolean type

I am trying to implement a backend using easyadmin, I think its a great idea and I love the implementation... so far is going well, but I have a little problem, I want to show in the form a boolean field, for ex: 'published', my configuration looks like this:

Blog:
    label: 'Posts list'
    class: MyCompany\MyBundle\Entity\Post
    list:
        fields: ['title', 'published']
    new:
        fields: 
          - 'title'
          - 'summary'
          - 'body'
          - { property: 'published', type: 'boolean' }

When I run this code, I get the error:

Could not load type "boolean"

This is how I define the field in the Entity:

/**
 * 
 * @ORM\Column(name="published", type="boolean", length=1)
 */
protected $published = 1;

Upvotes: 0

Views: 2886

Answers (2)

Victor Pinto
Victor Pinto

Reputation: 23

I know it's been a while since this question's posted, but for anyone still getting this error, in easyadmin documentation (https://github.com/javiereguiluz/EasyAdminBundle/blob/master/Resources/doc/book/4-edit-new-configuration.md) it is specified which types we need to use for each scenario (list, edit views). In your question (edit scenario) so far the only workaround is to use "checkbox"as type in config.yml. Edit view only accepts Symfony Form Types (http://symfony.com/doc/current/reference/forms/types.html).

Upvotes: 1

Maya Shah
Maya Shah

Reputation: 970

You don't have to specify type in configuration yml file. It will take automatically from entity.

Upvotes: 0

Related Questions