code: public function setRoles()
      {
          $this->roles = [];
          if (null !== $records = $this->select()) {
              foreach ($records as $record) {
                  $this->roles[(int) $record['id']] = $record['role'];
              }
          }
      }
docs: this is called by constructor and also should be called after a change to roles from single page app to reset them.