Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OSE
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
OSE
Commits
509b76b9
Commit
509b76b9
authored
Jun 12, 2015
by
lecluse
Browse files
Options
Downloads
Patches
Plain Diff
Optimisation : la liste des années courante en session
parent
bc60a025
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
module/Application/src/Application/Service/Annee.php
+21
-16
21 additions, 16 deletions
module/Application/src/Application/Service/Annee.php
module/Application/src/Application/Traits/SessionContainerTrait.php
+34
-0
34 additions, 0 deletions
...lication/src/Application/Traits/SessionContainerTrait.php
with
55 additions
and
16 deletions
module/Application/src/Application/Service/Annee.php
+
21
−
16
View file @
509b76b9
...
...
@@ -12,6 +12,7 @@ use Application\Entity\Db\Annee as AnneeEntity;
*/
class
Annee
extends
AbstractEntityService
{
use
\Application\Traits\SessionContainerTrait
;
/**
* retourne la classe des entités
...
...
@@ -103,6 +104,9 @@ class Annee extends AbstractEntityService
*/
public
function
getChoixAnnees
()
{
$session
=
$this
->
getSessionContainer
();
if
(
!
isset
(
$session
->
choixAnnees
)){
$sql
=
'SELECT DISTINCT
annee_id
FROM
...
...
@@ -114,12 +118,13 @@ class Annee extends AbstractEntityService
$stmt
=
$this
->
getEntityManager
()
->
getConnection
()
->
executeQuery
(
$sql
);
$result
=
$stmt
->
fetchAll
(
\PDO
::
FETCH_ASSOC
);
$a
nnees
=
[];
$session
->
choixA
nnees
=
[];
foreach
(
$result
as
$annee
){
$a
=
$annee
[
'ANNEE_ID'
];
$annees
[
$a
]
=
$a
.
'-'
.
(
$a
+
1
);
$session
->
choixAnnees
[
$a
]
=
$a
.
'-'
.
(
$a
+
1
);
}
}
return
$
a
nnees
;
return
$
session
->
choixA
nnees
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
module/Application/src/Application/Traits/SessionContainerTrait.php
0 → 100644
+
34
−
0
View file @
509b76b9
<?php
namespace
Application\Traits
;
use
Zend\Session\Container
as
SessionContainer
;
trait
SessionContainerTrait
{
private
$sessionContainer
;
/**
*
* @return SessionContainer
*/
public
function
getSessionContainer
()
{
if
(
null
===
$this
->
sessionContainer
)
{
$this
->
sessionContainer
=
new
SessionContainer
(
get_class
(
$this
)
);
}
return
$this
->
sessionContainer
;
}
/**
*
* @param SessionContainer $sessionContainer
* @return self
*/
public
function
setSessionContainer
(
SessionContainer
$sessionContainer
)
{
$this
->
sessionContainer
=
$sessionContainer
;
return
$this
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment