/** * Delete an entity profile from the database * * @return boolean */ public function delete() { // Check if the deleted profile is a last admin profile if ($this->isAdmin() && 1 == \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findCountOfAdminAccounts()) { $result = false; \XLite\Core\TopMessage::addError('The only remaining active administrator profile cannot be deleted.'); } else { $result = parent::delete(); } return $result; }