getId()) || !Space::exists($space->getId())) return; $this->user = $user; $this->space = $space; $this->role = $role; $this->addedAt = $addedAt; $this->favorited = $favorited; if ($id < 0) { $this->id = $id * -1; $stmt = 'INSERT INTO spaceMembers (id, user, space, role, favorited) VALUES (?, ?, ?, ?, ?)'; exec_stmt($stmt, 'iiiii', $this->id, $user->getId(), $space->getId(), $role, $favorited); } } public function getUser() { return $this->user; } public function getSpace() { return $this->space; } }