Reputation: 243
this is my ConfigureListFild
:
I want to show my account data in ConfigureListFields
with condition example (where type='client')
protected function configureListFields(ListMapper $listMapper)
{
// ... configure $listMapper
$listMapper
->addIdentifier('raison_sociale')
->add('type')
->add('category.name')
->add('portable')
->add('ville_fac')
->add('professionnel')
->add('_action', 'actions', array(
'actions' => array(
'show' => array(),
'edit' => array(),
'delete' => array(),
)
))
;
}
can you help my to show List of account by type = "Client" ??
Upvotes: 1
Views: 1751
Reputation: 440
You need to override createQuery method in your admin class something like that ;
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$rootAlias = $query->getRootAliases()[0];
$query->andWhere(
$query->expr()->eq($rootAlias.'.type', ':type')
);
$query->setParameter(':type', 'Client');
return $query;
}
Upvotes: 3