From 871b3e169e42bf995ca3333c10dcb4a9ffff2932 Mon Sep 17 00:00:00 2001 From: Tim Krehan Date: Sat, 2 Dec 2023 09:50:15 +0100 Subject: [PATCH] fix PHP 8 error requiring construct keyword --- php/classes.list.php | 8 ++++---- php/classes.recipe.php | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/php/classes.list.php b/php/classes.list.php index 2834111..58f6770 100644 --- a/php/classes.list.php +++ b/php/classes.list.php @@ -1,7 +1,7 @@ ID = $ID; $this->Anzahl = $Anzahl; $this->Einheit = $Einheit; @@ -16,7 +16,7 @@ array_push($this->list, $current); } - function shopping(){ + function __construct(){ include $_SESSION["docroot"].'/config/config.php'; include $_SESSION["docroot"].'/php/connect.php'; $result = $mysqli->query("SELECT * FROM `ViewEinkauf` ORDER BY `ViewEinkauf`.`Name` ASC;"); @@ -132,7 +132,7 @@ class unit { public $ID, $Name, $Standard; - function unit($ID, $Name, $Standard){ + function __construct($ID, $Name, $Standard){ $this->ID = $ID; $this->Name = $Name; $this->Standard = $Standard; @@ -145,7 +145,7 @@ array_push($this->list, $current); } - function units(){ + function __construct(){ include $_SESSION["docroot"].'/config/config.php'; include $_SESSION["docroot"].'/php/connect.php'; $result = $mysqli->query("SELECT * FROM `Einheit`;"); diff --git a/php/classes.recipe.php b/php/classes.recipe.php index 68b4440..34dd4ec 100644 --- a/php/classes.recipe.php +++ b/php/classes.recipe.php @@ -1,6 +1,7 @@ Standard = $Standard; array_push($this->units, $unit); } - function unitList(){ + function __construct(){ include $_SESSION["docroot"].'/php/connect.php'; $result = $mysqli->query("SELECT * FROM `Einheit`;"); while($item = $result->fetch_assoc()){ @@ -33,7 +34,7 @@ class ingredient { public $ID, $Menge, $Einheit, $Name; - function ingredient($ID, $Menge, $Einheit, $Name){ + function __construct($ID, $Menge, $Einheit, $Name){ $this->ID = $ID; $this->Menge = $Menge; $this->Einheit = $Einheit; @@ -44,7 +45,7 @@ class recipe { public $ID, $Name, $Dauer, $Beschreibung; public $Zutaten = array(); - function recipe($ID, $Name, $Dauer, $Beschreibung){ + function __construct($ID, $Name, $Dauer, $Beschreibung){ $this->ID = $ID; $this->Name = $Name; $this->Dauer = $Dauer;