diff options
| author | polo <ordipolo@gmx.fr> | 2025-10-22 15:28:02 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-10-22 15:28:02 +0200 |
| commit | c9aff025aa7e01badaad8467af6165b400cdaac4 (patch) | |
| tree | c6e56a3f13db401c9f75bf9f8e4169f50aaf25b9 /src/model | |
| parent | 426a1a69cb73007538336debc31b34c4348e1ba1 (diff) | |
| download | cms-c9aff025aa7e01badaad8467af6165b400cdaac4.tar.gz cms-c9aff025aa7e01badaad8467af6165b400cdaac4.tar.bz2 cms-c9aff025aa7e01badaad8467af6165b400cdaac4.zip | |
possibilité d'éditer le texte dans header et footer, class JS InputText, Model::findWhateverNode
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/Model.php | 18 |
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 |
