I am currently using Sonata Admin to generate a datagrid with an entity having a read
boolean field. I would like to filter on this property, setting it by default to false
.
So, I added the following to my Admin class:
protected $datagridValues = array(
'read' => array('value' => false),
);
Yet, it does not seem to work. The generated select list is the following:
<select id="filter_read_value" name="filter[read][value]" class="span8">
<option value=""></option>
<option value="1">oui</option>
<option value="2">non</option>
</select>
I suppose this is normal, as value
for false would be 0, which is the empty option.
So, I used some constants such as:
const STATUS_READ = 1;
const STATUS_UNREAD = 2;
It works, but I am wondering if there is any proper solution to avoid these two unnecessary constants?