Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Sorting on a Certificate column in the Managed Domains GridField fails #3

Open
indygriffiths opened this issue Jun 26, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@indygriffiths
Copy link
Owner

ERROR [User Error]: Uncaught SS_DatabaseException: Couldn't run query:

SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"

FROM "Domain"
LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID"

Unknown column 'DataObject.CurrentCertificateID' in 'on clause'
IN POST /admin/domains/Domain/EditForm/field/Domain
Line 55 in /Users/indygriffiths/Dev/PHP7/locksmith/framework/model/connect/DBConnector.php

Source
======
  46:  		if (!empty($sql)) {
  47:  			$formatter = new SQLFormatter();
  48:  			$formattedSQL = $formatter->formatPlain($sql);
  49:  			$msg = "Couldn't run query:\n\n{$formattedSQL}\n\n{$msg}";
  50:  		}
  51:  
  52:  		if($errorLevel === E_USER_ERROR) {
  53:  			// Treating errors as exceptions better allows for responding to errors
  54:  			// in code, such as credential checking during installation
* 55:  			throw new SS_DatabaseException($msg, 0, null, $sql, $parameters);
  56:  		} else {
  57:  			user_error($msg, $errorLevel);
  58:  		}
  59:  	}
  60:  
  61:  	/**

Trace
=====
DBConnector->databaseError(Couldn't run query:

SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"

FROM "Domain"
LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID"

Unknown column 'DataObject.CurrentCertificateID' in 'on clause',256,SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"
 FROM "Domain" LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID")
MySQLiConnector.php:155

MySQLiConnector->query(SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"
 FROM "Domain" LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID",256)
MySQLiConnector.php:243

MySQLiConnector->preparedQuery(SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"
 FROM "Domain" LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID",Array,256)
Database.php:143

SS_Database->{closure}(SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"
 FROM "Domain" LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID")
Database.php:193

SS_Database->benchmarkQuery(SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"
 FROM "Domain" LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID",Closure,Array)
Database.php:145

SS_Database->preparedQuery(SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"
 FROM "Domain" LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID",Array,256)
DB.php:365

DB::prepared_query(SELECT DISTINCT count(DISTINCT "Domain"."ID") AS "Count"
 FROM "Domain" LEFT JOIN "Certificate" AS "CurrentCertificate" ON "CurrentCertificate"."ID" = "DataObject"."CurrentCertificateID",Array)
SQLExpression.php:121

SQLExpression->execute()
SQLSelect.php:599

SQLSelect->count(DISTINCT "Domain"."ID")
DataQuery.php:399

DataQuery->count()
DataList.php:769

DataList->count()
GridFieldPaginator.php:139

GridFieldPaginator->getManipulatedData(GridField,DataList)
GridField.php:257

GridField->getManipulatedList()
GridField.php:300

GridField->FieldHolder()
GridField.php:899

GridField->gridFieldAlterAction(Array,CMSForm,SS_HTTPRequest)
GridField.php:118

GridField->index(SS_HTTPRequest)
RequestHandler.php:296

RequestHandler->handleAction(SS_HTTPRequest,index)
RequestHandler.php:208

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
GridField.php:1030

GridField->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:230

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:230

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:151

Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:472

LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:92

AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:385

Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:149

Director::direct(/admin/domains/Domain/EditForm/field/Domain,DataModel)
main.php:194

@indygriffiths indygriffiths added the bug Something isn't working label Jun 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant