I have an entity Transaction with numerous status codes. I want the user to be able to see these status codes as strings in SonataAdmin. The user should also be able to filter
This worked as a temporary solution for me. If anyone has a better solution, please share.
$datagridMapper
->add('status', 'doctrine_orm_string', array(),
'choice', array('choices' => Transaction::getStatusList())
);
In the entity
public static function getStatusList()
{
return array(
self::TRANSACTION_STATUS_WAITING => "Waiting",
self::TRANSACTION_STATUS_PENDING_CONFIRMATION => "Pending Confirmation",
self::TRANSACTION_STATUS_CONFIRMED => "Confirmed",
self::TRANSACTION_STATUS_PAYMENT_REQUESTED => "Payment Requested",);
}