From 2d8ec75f4aaf3b93fd9f6758f8dcb4f1f9f03d0c Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 7 May 2025 01:11:27 +0200 Subject: page menu et chemins, partie5 --- src/model/entities/Page.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/model/entities/Page.php') diff --git a/src/model/entities/Page.php b/src/model/entities/Page.php index aaff1ff..9564342 100644 --- a/src/model/entities/Page.php +++ b/src/model/entities/Page.php @@ -135,11 +135,9 @@ class Page } public function removeChild(self $child): void { - foreach($this->children as $index => $candidate){ - if($candidate === $child){ - unset($this->children[$index]); - } - } + $this->children->removeElement($child); + $this->children = new ArrayCollection(array_values($this->children->toArray())); // réindexer en passant par un tableau + $this->sortChildren(false); } public function findPageById(int $id): ?Page -- cgit v1.2.3