Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
cooperatic-mlc
kohinos
Commits
98516315
Commit
98516315
authored
Mar 13, 2019
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stats for presta / partenaire on homepage
parent
1894398b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
StatsExtension.php
src/Twig/StatsExtension.php
+11
-17
No files found.
src/Twig/StatsExtension.php
View file @
98516315
...
@@ -32,33 +32,29 @@ class StatsExtension extends AbstractExtension
...
@@ -32,33 +32,29 @@ class StatsExtension extends AbstractExtension
public
function
showMlcStats
(
$stats
)
public
function
showMlcStats
(
$stats
)
{
{
$class
=
''
;
$class
=
''
;
switch
(
$stats
)
{
switch
(
$stats
)
{
case
'user'
:
case
'user'
:
$class
=
'App\Entity\User'
;
$class
=
'App\Entity\User'
;
break
;
break
;
case
'prestataire'
:
case
'prestataire'
:
$class
=
'App\Entity\Prestataire'
;
$class
=
null
;
$typepresta
=
$this
->
em
->
getRepository
(
TypePrestataire
::
class
)
->
findOneBySlug
(
'prestataire'
);
$typepresta
=
$this
->
em
->
getRepository
(
TypePrestataire
::
class
)
->
findOneBySlug
(
'prestataire'
);
$query
=
$this
->
em
->
createQuery
(
$query
=
$this
->
em
->
createQuery
(
'SELECT count(distinct p.id)
'SELECT count(distinct p.id)
FROM '
.
$class
.
' p
FROM App\\Entity\\Prestataire p
WHERE p.enabled = true AND p.typeprestataire = :typepresta
WHERE p.enabled = true AND p.typeprestataire = :typepresta'
'
)
)
->
setParameter
(
'typepresta'
,
$typepresta
);
->
setParameter
(
'typepresta'
,
$typepresta
)
;
$val
=
$query
->
getSingleScalarResult
();
$val
=
$query
->
getSingleScalarResult
();
break
;
break
;
case
'partenaire'
:
case
'partenaire'
:
$class
=
'App\Entity\Prestataire'
;
$class
=
null
;
$typepresta
=
$this
->
em
->
getRepository
(
TypePrestataire
::
class
)
->
findOneBySlug
(
'partenaire'
);
$typepresta
=
$this
->
em
->
getRepository
(
TypePrestataire
::
class
)
->
findOneBySlug
(
'partenaire'
);
$query
=
$this
->
em
->
createQuery
(
$query
=
$this
->
em
->
createQuery
(
'SELECT count(distinct p.id)
'SELECT count(distinct p.id)
FROM '
.
$class
.
' p
FROM App\\Entity\\Prestataire p
WHERE p.enabled = true AND p.typeprestataire = :typepresta
WHERE p.enabled = true AND p.typeprestataire = :typepresta'
'
)
)
->
setParameter
(
'typepresta'
,
$typepresta
);
->
setParameter
(
'typepresta'
,
$typepresta
)
;
$val
=
$query
->
getSingleScalarResult
();
$val
=
$query
->
getSingleScalarResult
();
break
;
break
;
...
@@ -71,15 +67,13 @@ class StatsExtension extends AbstractExtension
...
@@ -71,15 +67,13 @@ class StatsExtension extends AbstractExtension
case
'groupe'
:
case
'groupe'
:
$class
=
'App\Entity\Groupe'
;
$class
=
'App\Entity\Groupe'
;
break
;
break
;
}
}
if
(
!
empty
(
$class
))
{
if
(
!
empty
(
$class
))
{
$query2
=
$this
->
em
->
createQuery
(
$query2
=
$this
->
em
->
createQuery
(
'SELECT count(distinct u.id)
'SELECT count(distinct u.id)
FROM '
.
$class
.
' u
FROM '
.
$class
.
' u
WHERE u.enabled = true
WHERE u.enabled = true'
'
)
);
;
$val
=
$query2
->
getSingleScalarResult
();
$val
=
$query2
->
getSingleScalarResult
();
}
}
...
...
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