Example #1
0
 /**
  * Create a new user object from a user row.
  * The row should have the following fields from the user table in it:
  * - either user_name or user_id to load further data if needed (or both)
  * - user_real_name
  * - all other fields (email, password, etc.)
  * It is useless to provide the remaining fields if either user_id,
  * user_name and user_real_name are not provided because the whole row
  * will be loaded once more from the database when accessing them.
  *
  * @param $row Array A row from the user table
  * @return User
  */
 public static function newFromRow($row)
 {
     $user = new User();
     $user->loadFromRow($row);
     return $user;
 }
Example #2
0
 /**
  * Create a new user object from a user row.
  * The row should have the following fields from the user table in it:
  * - either user_name or user_id to load further data if needed (or both)
  * - user_real_name
  * - all other fields (email, password, etc.)
  * It is useless to provide the remaining fields if either user_id,
  * user_name and user_real_name are not provided because the whole row
  * will be loaded once more from the database when accessing them.
  *
  * @param stdClass $row A row from the user table
  * @param array $data Further data to load into the object (see User::loadFromRow for valid keys)
  * @return User
  */
 public static function newFromRow($row, $data = null)
 {
     $user = new User();
     $user->loadFromRow($row, $data);
     return $user;
 }