}
/**
- * Create a query to find references to a particular record
+ * Create a query to find references to a particular record.
*
* @param CRM_Core_DAO $targetDao
* The instance for which we want references.
$refColumn = $this->getReferenceKey();
$targetColumn = $this->getTargetKey();
- $params = array(
- 1 => array($targetDao->$targetColumn, 'String'),
+ $params = [
+ 1 => [$targetDao->$targetColumn, 'String'],
// If anyone complains about $targetDao::getTableName(), then could use
// "{get_class($targetDao)}::getTableName();"
- 2 => array($targetDao::getTableName(), 'String'),
- );
+ 2 => [$targetDao::getTableName(), 'String'],
+ ];
$sql = <<<EOS
SELECT id
*/
public function getReferenceCount($targetDao) {
$targetColumn = $this->getTargetKey();
- $params = array(
- 1 => array($targetDao->$targetColumn, 'String'),
+ $params = [
+ 1 => [$targetDao->$targetColumn, 'String'],
// If anyone complains about $targetDao::getTableName(), then could use
// "{get_class($targetDao)}::getTableName();"
- 2 => array($targetDao::getTableName(), 'String'),
- );
+ 2 => [$targetDao::getTableName(), 'String'],
+ ];
$sql = <<<EOS
SELECT count(id)
AND {$this->getTypeColumn()} = %2
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),
- );
+ ];
}
}