fixed old bugs regarding changed db specs
Deploy vintagecoding.net / deploy (push) Canceled after 0s
Deploy vintagecoding.net / deploy (push) Canceled after 0s
This commit is contained in:
+6
-7
@@ -27,7 +27,7 @@ class Space
|
||||
$this->id = $id * -1;
|
||||
error_log('ID: ' . $this->id);
|
||||
|
||||
$stmt = 'INSERT INTO space (id, name, description, visibility, parentSpace) VALUES (?, ?, ?, ?, ?)';
|
||||
$stmt = 'INSERT INTO space (id, name, description, visibility, parent) VALUES (?, ?, ?, ?, ?)';
|
||||
exec_stmt($stmt, 'issii', $this->id, $name, $description, $visibility, (isset($parent) ? $parent->getId() : null));
|
||||
error_log('Added space in DB');
|
||||
} else
|
||||
@@ -57,13 +57,12 @@ class Space
|
||||
|
||||
public function getSubSpaces(): ?array
|
||||
{
|
||||
$stmt = 'SELECT id FROM space WHERE parentSpace = ?';
|
||||
$stmt = 'SELECT id FROM space WHERE parent = ?';
|
||||
$rawSubSpaces = exec_stmt($stmt, 'i', $this->id);
|
||||
|
||||
$subSpaces = [];
|
||||
foreach ($rawSubSpaces as $ss) {
|
||||
foreach ($rawSubSpaces as $ss)
|
||||
$subSpaces[] = Space::retrieveFromDB($ss['id']);
|
||||
}
|
||||
|
||||
return $subSpaces;
|
||||
}
|
||||
@@ -136,8 +135,8 @@ class Space
|
||||
$rawSpace = exec_stmt($stmt, 'i', $space)->fetch_assoc();
|
||||
|
||||
if ($rawSpace) {
|
||||
if (!empty($rawSpace['parentSpace']))
|
||||
$parent = Space::retrieveFromDB($rawSpace['parentSpace'], $user);
|
||||
if (!empty($rawSpace['parent']))
|
||||
$parent = Space::retrieveFromDB($rawSpace['parent'], $user);
|
||||
else
|
||||
$parent = null;
|
||||
|
||||
@@ -147,7 +146,7 @@ class Space
|
||||
foreach ($rawMembers as $m)
|
||||
$members[] = User::retrieveFromDB($m['user']);
|
||||
|
||||
$stmt = 'SELECT post FROM spacePosts INNER JOIN post ON spacePosts.post = post.id WHERE space = ? ORDER BY post.createdAt DESC';
|
||||
$stmt = 'SELECT post FROM spacePosts INNER JOIN post ON spacePosts.post = post.id WHERE spacePosts.space = ? ORDER BY post.createdAt DESC';
|
||||
$posts = [];
|
||||
$rawPosts = exec_stmt($stmt, 'i', $rawSpace['id']);
|
||||
while ($row = $rawPosts->fetch_assoc())
|
||||
|
||||
Reference in New Issue
Block a user