/** * @return User */ public function user() { return User::instance($this->preferences, $this->mysql->getHandler()); }
public function removeUserFromRole($userId, $roleId) { if (User::instance($this->preferences, $this->db)->findById($userId) && Role::instance($this->preferences, $this->db)->findById($roleId)) { try { $sql = "DELETE FROM rpd_user_has_role WHERE id_user = :userId AND id_role = :roleId"; $stmt = $this->db->prepare($sql); $stmt->bindParam(':userId', $userId, PDO::PARAM_INT); $stmt->bindParam(':roleId', $roleId, PDO::PARAM_INT); return $stmt->execute(); } catch (\PDOException $e) { MySQL::instance()->showException($e); } } return false; }