wip pmelo: still promoting missing

This commit is contained in:
marko
2024-01-23 19:49:41 +01:00
parent 62bd7cb14b
commit e04de32c56
3 changed files with 115 additions and 50 deletions

View File

@@ -159,13 +159,13 @@ class User
/** List of users kids */
private $kids = null;
public function kidIds(bool $forceLoading = false)
{
if (is_null($this->kidIds) || $forceLoading) {
$this->kidIds = self::getKidIds($id);
}
return self::$kidIds;
}
// public function kidIds(bool $forceLoading = false)
// {
// if (is_null($this->kidIds) || $forceLoading) {
// $this->kidIds = self::getKidIds($id);
// }
// return self::$kidIds;
// }
public function kids(bool $forceLoading = false)
{
@@ -175,26 +175,26 @@ class User
return $this->kids;
}
private static function getKidIds(int $id)
{
$response = dbConnector::query(
'SELECT * FROM `wkParticipo_Users` WHERE `' . $name . '` = :' . $name,
[$name => ['value' => $value, 'data_type' => self::$dbColumns[$name]]]
);
// private static function getKidIds(int $id)
// {
// $response = dbConnector::query(
// 'SELECT * FROM `wkParticipo_Users` WHERE `' . $name . '` = :' . $name,
// [$name => ['value' => $value, 'data_type' => self::$dbColumns[$name]]]
// );
$query = <<<SQL
SELECT *
FROM `wkParticipo_Users`
JOIN `vormundschaft`
ON `wkParticipo_Users`.`id` = `vormundschaft`.`kidId`
WHERE `vormundschaft`.`userId` = :userId;
SQL;
$params = [
':userId' => ['value' => $userId, 'data_type' => PDO::PARAM_INT]
];
$response = dbConnector::query($query, $params);
return $response;
}
// $query = <<<SQL
// SELECT *
// FROM `wkParticipo_Users`
// JOIN `vormundschaft`
// ON `wkParticipo_Users`.`id` = `vormundschaft`.`kidId`
// WHERE `vormundschaft`.`userId` = :userId;
// SQL;
// $params = [
// ':userId' => ['value' => $userId, 'data_type' => PDO::PARAM_INT]
// ];
// $response = dbConnector::query($query, $params);
// return $response;
// }
/** Export the User data into an associative array
*
@@ -248,9 +248,12 @@ SQL;
public function getConfig()
{
return $this->$config;
return $this->config;
}
public function getDateOfBirth(){
return $this->dateOfBirth;
}
public function getStrBirthday(){
return $this->dateOfBirth->format("Y-m-d");
}