/**
  * destroys the cmsprofile from persistence (MySQL for now).
  *
  * @return void
  * @access public
  */
 function destroy()
 {
     parent::destroy();
     if ($this->_groupId) {
         $sql = "\n\t\t\t\tdelete\n\t\t\t\tfrom\n\t\t\t\t\tprofilesUsersGroups\n\t\t\t\twhere\n\t\t\t\t\tid_prg='" . $this->_groupId . "'\n\t\t\t";
         $q = new CMS_query($sql);
         $sql = "\n\t\t\t\tdelete\n\t\t\t\tfrom\n\t\t\t\t\tprofileUsersByGroup\n\t\t\t\twhere\n\t\t\t\t\tgroupId_gu='" . $this->_groupId . "'\n\t\t\t";
         $q = new CMS_query($sql);
     }
     $this->applyToUsers();
     unset($this);
     //Clear polymod cache
     //CMS_cache::clearTypeCacheByMetas('polymod', array('resource' => 'users'));
     CMS_cache::clearTypeCache('polymod');
 }