Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
b10ac4fc
Commit
b10ac4fc
authored
Mar 16, 2022
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Admin operation prestataire : add filter by groupe
parent
f02d2a5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletions
+28
-1
OperationPrestataireAdmin.php
src/Admin/OperationPrestataireAdmin.php
+28
-1
No files found.
src/Admin/OperationPrestataireAdmin.php
View file @
b10ac4fc
...
@@ -3,10 +3,12 @@
...
@@ -3,10 +3,12 @@
namespace
App\Admin
;
namespace
App\Admin
;
use
App\Entity\AccountPrestataire
;
use
App\Entity\AccountPrestataire
;
use
App\Entity\Groupe
;
use
App\Entity\OperationPrestataire
;
use
App\Entity\OperationPrestataire
;
use
App\Entity\Prestataire
;
use
App\Entity\Prestataire
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\ListMapper
;
use
Sonata\AdminBundle\Datagrid\ListMapper
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
/**
/**
* Administration des operation des prestataires.
* Administration des operation des prestataires.
...
@@ -64,13 +66,38 @@ class OperationPrestataireAdmin extends OperationAdmin
...
@@ -64,13 +66,38 @@ class OperationPrestataireAdmin extends OperationAdmin
protected
function
configureDatagridFilters
(
DatagridMapper
$datagridMapper
)
:
void
protected
function
configureDatagridFilters
(
DatagridMapper
$datagridMapper
)
:
void
{
{
parent
::
configureDatagridFilters
(
$datagridMapper
);
parent
::
configureDatagridFilters
(
$datagridMapper
);
$em
=
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getManager
();
$datagridMapper
$datagridMapper
->
add
(
'account.prestataire'
,
null
,
[
->
add
(
'account.prestataire'
,
null
,
[
'label'
=>
'Prestataire'
,
'label'
=>
'Prestataire'
,
'advanced_filter'
=>
false
,
'advanced_filter'
=>
false
,
'show_filter'
=>
true
,
'show_filter'
=>
true
,
])
])
//@TODO : add by groupe filter /
->
add
(
'groupe'
,
'doctrine_orm_callback'
,
[
'label'
=>
'Groupe local'
,
'callback'
=>
function
(
$queryBuilder
,
$alias
,
$field
,
$value
)
{
if
(
!
$value
[
'value'
])
{
return
;
}
$queryBuilder
->
leftJoin
(
$alias
.
'.account'
,
'a'
)
->
leftJoin
(
'App\Entity\Prestataire'
,
'p'
,
'WITH'
,
'a.prestataire = p'
)
->
andWhere
(
'p.groupe = :groupe'
)
->
setParameter
(
'groupe'
,
$value
[
'value'
]);
return
true
;
},
'advanced_filter'
=>
false
,
'show_filter'
=>
true
,
'field_type'
=>
ChoiceType
::
class
,
'field_options'
=>
[
'choices'
=>
$em
->
getRepository
(
Groupe
::
class
)
->
findBy
([
'enabled'
=>
true
],
[
'name'
=>
'ASC'
]),
'choice_label'
=>
'name'
,
'placeholder'
=>
'Indifférent'
,
'expanded'
=>
false
,
'multiple'
=>
false
,
],
])
;
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment