EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

bug with boolean toggle field

Open 228vit opened this issue 11 years ago • 4 comments

Suppose we've got boolean field:

    /**
     * @var boolean
     * @ORM\Column(name="is_active", type="boolean")
     */
    private $is_active;

If you try to customize list action:

            list:
                fields:
                    - name
                    - is_active

You will get red warning "inaccessible" for field "is_active"

Boolean fields w/names like active|available|archive displayed and customized w/o problems

228vit avatar Nov 18 '15 21:11 228vit

The $is_active property is private, so your entity must have any of the following public methods to be readable (the first one that exists is used):

getIs_active()
isIs_active()
is_active()
hasIs_active()
getIsActive()
isIsActive()
isActive()
hasIsActive()

To be writable/editable, we look for these methods:

setIs_active()
setIsIs_active()
setIsActive()
setIsIsActive()

javiereguiluz avatar Nov 18 '15 21:11 javiereguiluz

But... appropriate methods are exists in model

/**
 * Get is_active
 *
 * @return boolean 
 */
public function getIsActive()
{
    return $this->is_active;
}
/**
 * Set is_active
 *
 * @param boolean $isActive
 * @return Product
 */
public function setIsActive($isActive)
{
    $this->is_active = $isActive;

    return $this;
}

228vit avatar Nov 19 '15 09:11 228vit

Then this is a bug. I'll take a look into it.

javiereguiluz avatar Nov 19 '15 09:11 javiereguiluz

I can confirm the bug and I've proposed a fix in #585.

javiereguiluz avatar Nov 21 '15 19:11 javiereguiluz