aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/Model.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/model/Model.php b/src/model/Model.php
index ea8ef71..16061e7 100644
--- a/src/model/Model.php
+++ b/src/model/Model.php
@@ -185,6 +185,24 @@ class Model
185 $this->node = $this->entityManager->find('App\Entity\Node', $id); 185 $this->node = $this->entityManager->find('App\Entity\Node', $id);
186 return $this->node === null ? false : true; 186 return $this->node === null ? false : true;
187 } 187 }
188 public function findWhateverNode(string $field, string $value): bool
189 {
190 $queryBuilder = $this->entityManager->createQueryBuilder();
191 $queryBuilder
192 ->select('n')
193 ->from('App\Entity\Node', 'n')
194 ->where("n.$field = :value") // avec le querybuilder, ce truc sale reste sécurisé
195 ->setParameter('value', $value);
196 $result = $queryBuilder->getQuery()->getOneOrNullResult();
197
198 if($result === null){
199 return false;
200 }
201 else{
202 $this->node = $result;
203 return true;
204 }
205 }
188 206
189 // récupération d'un article pour modification 207 // récupération d'un article pour modification
190 public function makeArticleNode(string $id = '', bool $get_section = false): bool 208 public function makeArticleNode(string $id = '', bool $get_section = false): bool