projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #14583 from seamuslee001/convert_custom_fields_cache_group
[civicrm-core.git]
/
CRM
/
Core
/
CodeGen
/
DAO.php
diff --git
a/CRM/Core/CodeGen/DAO.php
b/CRM/Core/CodeGen/DAO.php
index 8db0b9d36b6871aa89ce1cd23d869ea6d58feb0a..69cc8d0e479ac4d59b5479f9e01fb027ca1f8111 100644
(file)
--- a/
CRM/Core/CodeGen/DAO.php
+++ b/
CRM/Core/CodeGen/DAO.php
@@
-20,15
+20,23
@@
class CRM_Core_CodeGen_DAO extends CRM_Core_CodeGen_BaseTask {
*/
private $raw;
*/
private $raw;
+ /**
+ * @var string
+ * translate function name
+ */
+ private $tsFunctionName;
+
/**
* CRM_Core_CodeGen_DAO constructor.
*
* @param \CRM_Core_CodeGen_Main $config
* @param string $name
/**
* CRM_Core_CodeGen_DAO constructor.
*
* @param \CRM_Core_CodeGen_Main $config
* @param string $name
+ * @param string $tsFunctionName
*/
*/
- public function __construct($config, $name) {
+ public function __construct($config, $name
, $tsFunctionName = 'ts'
) {
parent::__construct($config);
$this->name = $name;
parent::__construct($config);
$this->name = $name;
+ $this->tsFunctionName = $tsFunctionName;
}
/**
}
/**
@@
-62,7
+70,14
@@
class CRM_Core_CodeGen_DAO extends CRM_Core_CodeGen_BaseTask {
$template = new CRM_Core_CodeGen_Util_Template('php');
$template->assign('table', $this->tables[$this->name]);
$template = new CRM_Core_CodeGen_Util_Template('php');
$template->assign('table', $this->tables[$this->name]);
+ if (empty($this->tables[$this->name]['index'])) {
+ $template->assign('indicesPhp', var_export([], 1));
+ }
+ else {
+ $template->assign('indicesPhp', var_export($this->tables[$this->name]['index'], 1));
+ }
$template->assign('genCodeChecksum', $this->getTableChecksum());
$template->assign('genCodeChecksum', $this->getTableChecksum());
+ $template->assign('tsFunctionName', $this->tsFunctionName);
$template->run('dao.tpl', $this->getAbsFileName());
}
$template->run('dao.tpl', $this->getAbsFileName());
}
@@
-75,7
+90,14
@@
class CRM_Core_CodeGen_DAO extends CRM_Core_CodeGen_BaseTask {
if (!$this->raw) {
$template = new CRM_Core_CodeGen_Util_Template('php');
$template->assign('table', $this->tables[$this->name]);
if (!$this->raw) {
$template = new CRM_Core_CodeGen_Util_Template('php');
$template->assign('table', $this->tables[$this->name]);
+ if (empty($this->tables[$this->name]['index'])) {
+ $template->assign('indicesPhp', var_export([], 1));
+ }
+ else {
+ $template->assign('indicesPhp', var_export($this->tables[$this->name]['index'], 1));
+ }
$template->assign('genCodeChecksum', 'NEW');
$template->assign('genCodeChecksum', 'NEW');
+ $template->assign('tsFunctionName', $this->tsFunctionName);
$this->raw = $template->fetch('dao.tpl');
}
return $this->raw;
$this->raw = $template->fetch('dao.tpl');
}
return $this->raw;
@@
-109,6
+131,7
@@
class CRM_Core_CodeGen_DAO extends CRM_Core_CodeGen_BaseTask {
*/
protected function getTableChecksum() {
if (!$this->tableChecksum) {
*/
protected function getTableChecksum() {
if (!$this->tableChecksum) {
+ $flat = [];
CRM_Utils_Array::flatten($this->tables[$this->name], $flat);
ksort($flat);
$this->tableChecksum = md5(json_encode($flat));
CRM_Utils_Array::flatten($this->tables[$this->name], $flat);
ksort($flat);
$this->tableChecksum = md5(json_encode($flat));