private $useHelper = '';
+ private $ext = "'civicrm'";
+
/**
* CRM_Core_CodeGen_DAO constructor.
*
parent::__construct($config);
$this->name = $name;
$this->tsFunctionName = $tsFunctionName;
- // Cleanup helper class with a use statement
+ // If this DAO belongs to an extension, add `use` statement and define EXT constant.
if (strpos($tsFunctionName, '::ts')) {
$this->tsFunctionName = 'E::ts';
$this->useHelper = 'use \\' . explode('::', $tsFunctionName)[0] . ' as E;';
+ $this->ext = 'E::LONG_NAME';
}
}
$template->assign('indicesPhp', var_export($this->tables[$this->name]['index'], 1));
}
$template->assign('tsFunctionName', $this->tsFunctionName);
+ $template->assign('ext', $this->ext);
$template->assign('useHelper', $this->useHelper);
return $template;
}
'objectName' => $klass,
'title' => $tableXML->title ?? self::nameToTitle($klass),
'icon' => $tableXML->icon ?? NULL,
+ 'add' => $tableXML->add ?? NULL,
'labelName' => substr($name, 8),
'className' => $this->classNames[$name],
'bao' => ($useBao ? str_replace('DAO', 'BAO', $this->classNames[$name]) : $this->classNames[$name]),