use Waystone\Workspaces\Engines\Errors\ErrorHandling;
use Waystone\Workspaces\Engines\Workspaces\Workspace;
use Keruald\Database\DatabaseEngine;
+use UserGroup;
+
/**
* User class
*/
class User {
public ?int $id;
public $name;
public $password;
public $active = 0;
public $email;
public $regdate;
public array $session = [];
public string $lastError;
/**
* @var array|null An array of the workspaces the user has access to, each element an instance of the Workspace object. As long as the field hasn't been initialized by get_workspaces, null.
*/
private $workspaces = null;
private DatabaseEngine $db;
- /*
- * Initializes a new instance
+ ///
+ /// Constructors
+ ///
+
+ public static function fromRow (array $row) : self {
+ $user = new self;
+ $user->load_from_row($row);
+
+ return $user;
+ }
+
+ /**
+ * Create a new user instance with arbitrary user_id
+ *
+ * The created user is not saved in the database.