X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FReference%2FBasic.php;h=a3e1fe73f8a717ca9423c0fdfebfd200c5c7cca9;hb=fa5e0fda22da5e17858fcffcff09561b408c35c7;hp=572e96305879800c1dbfdba0aa0188b02545351a;hpb=00be918220e9ac8f6d25d12ed3c9c49fddd07ff7;p=civicrm-core.git diff --git a/CRM/Core/Reference/Basic.php b/CRM/Core/Reference/Basic.php index 572e963058..a3e1fe73f8 100644 --- a/CRM/Core/Reference/Basic.php +++ b/CRM/Core/Reference/Basic.php @@ -78,11 +78,16 @@ class CRM_Core_Reference_Basic implements CRM_Core_Reference_Interface { */ public function findReferences($targetDao) { $targetColumn = $this->getTargetKey(); - $params = array( - 1 => array($targetDao->$targetColumn, 'String') - ); + $select = 'id'; + // CRM-19385: Since id is removed, return all rows for cache tables. + if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists($this->getReferenceTable(), 'id')) { + $select = '*'; + } + $params = [ + 1 => [$targetDao->$targetColumn, 'String'], + ]; $sql = <<getReferenceTable()} WHERE {$this->getReferenceKey()} = %1 EOS; @@ -99,21 +104,22 @@ EOS; */ public function getReferenceCount($targetDao) { $targetColumn = $this->getTargetKey(); - $params = array( - 1 => array($targetDao->$targetColumn, 'String') - ); + $params = [ + 1 => [$targetDao->$targetColumn, 'String'], + ]; $sql = <<getReferenceTable()} WHERE {$this->getReferenceKey()} = %1 EOS; - return array( - 'name' => implode(':', array('sql', $this->getReferenceTable(), $this->getReferenceKey())), + return [ + 'name' => implode(':', ['sql', $this->getReferenceTable(), $this->getReferenceKey()]), 'type' => get_class($this), 'table' => $this->getReferenceTable(), 'key' => $this->getReferenceKey(), - 'count' => CRM_Core_DAO::singleValueQuery($sql, $params) - ); + 'count' => CRM_Core_DAO::singleValueQuery($sql, $params), + ]; } + }