diff options
author | polo <ordipolo@gmx.fr> | 2025-09-17 16:52:43 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2025-09-17 16:52:43 +0200 |
commit | 027af942de75f7c5bc519fabfa5fa11de9bc89ea (patch) | |
tree | f8074c57d59e99e036152369f2808046aa0004ec /src/model/Position.php | |
parent | 07819d9f9e151e9fed6a6490dcad53ba2d57a550 (diff) | |
download | cms-027af942de75f7c5bc519fabfa5fa11de9bc89ea.zip |
optimisation récursivité dans sortChildren uniquement avec les pages, regression constructeur MenuBuilder
Diffstat (limited to 'src/model/Position.php')
-rw-r--r-- | src/model/Position.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/model/Position.php b/src/model/Position.php index 8035481..fdba271 100644 --- a/src/model/Position.php +++ b/src/model/Position.php | |||
@@ -23,9 +23,13 @@ trait Position | |||
23 | $this->children[$j + 1] = $tmp; | 23 | $this->children[$j + 1] = $tmp; |
24 | } | 24 | } |
25 | 25 | ||
26 | foreach($this->children as $child) { | 26 | // récursivité (utile dans Menu et chemin) |
27 | if(count($child->children) > 0) { | 27 | // appel dans Page et dans MenuAndPathController (un tri supplémentaire à faire?) |
28 | $child->sortChildren($reindexation); | 28 | if(self::class === 'App\Entity\Page'){ |
29 | foreach($this->children as $child) { | ||
30 | if(count($child->children) > 0) { | ||
31 | $child->sortChildren($reindexation); | ||
32 | } | ||
29 | } | 33 | } |
30 | } | 34 | } |
31 | 35 | ||