Changement du modèle SQL : le contenu de content_version est désormais en json (pour pouvoir recevoir les POI), et on a créé la base pour la géométrie à venir des POIs

This commit is contained in:
leosw
2026-01-18 12:10:39 +01:00
parent 49e83aef49
commit 7d39b5295a
6 changed files with 273 additions and 1240 deletions

View File

@@ -66,6 +66,8 @@ class BlogArticle
** Populate the object using its ID
*****/
public function populate($row) {
$json = json_decode($row['content'], true);
$this->content_id = $row['content_id'];
$this->locale_id = $row['locale_id'];
$this->version_id = $row['version_id'];
@@ -80,7 +82,7 @@ class BlogArticle
$this->is_commentable = $row['is_commentable'];
$this->type = $row['type'];
$this->name = $row['name'];
$this->content = $row['content'];
$this->content = isset($json['text']) ? $json['text'] : '';
}
/*****
@@ -110,7 +112,9 @@ class BlogArticle
pg_prepare($con, "prepare2", $query)
or die ("Cannot prepare statement\n");
$result = pg_execute($con, "prepare2", array($this->version, date('r'), $this->name, $this->content, $this->locale_id))
$jsonContent = json_encode(['text' => $this->content]);
$result = pg_execute($con, "prepare2", array($this->version, date('r'), $this->name, $jsonContent, $this->locale_id))
or die ("Cannot execute statement\n");
$this->version_id = pg_fetch_assoc($result)['id'];
@@ -216,7 +220,9 @@ class BlogArticle
pg_prepare($con, "prepare3", $query)
or die ("Cannot prepare statement\n");
$result = pg_execute($con, "prepare3", array(date('r'), $this->name, $this->content, $this->locale_id))
$jsonContent = json_encode(['text' => $this->content]);
$result = pg_execute($con, "prepare3", array(date('r'), $this->name, $jsonContent, $this->locale_id))
or die ("Cannot execute statement\n");
$this->version_id = pg_fetch_assoc($result)['id'];