4 * Create classes which are used for schema introspection.
6 class CRM_Core_CodeGen_Reflection
extends CRM_Core_CodeGen_BaseTask
{
17 * TRUE if an update is needed.
19 public function needsUpdate() {
20 if (!file_exists($this->getAbsFileName())) {
24 // Generating this file is fairly cheap, and we don't have robust heuristic
26 // if ($this->getSchemaChecksum() !== self::extractRegex($this->getAbsFileName(), ';\(GenCodeChecksum:([a-zA-Z0-9]+)\);')) {
30 return !$this->isApproxPhpMatch(
31 file_get_contents($this->getAbsFileName()),
39 public function run() {
40 echo "Generating table list\n";
41 $template = new CRM_Core_CodeGen_Util_Template('php');
42 $template->assign('tables', $this->tables
);
43 $template->assign('genCodeChecksum', 'IGNORE');
44 $template->run('listAll.tpl', $this->getAbsFileName());
48 * Generate the raw PHP code for the data file.
52 public function getRaw() {
54 $template = new CRM_Core_CodeGen_Util_Template('php');
55 $template->assign('tables', $this->tables
);
56 $template->assign('genCodeChecksum', 'NEW');
57 $this->raw
= $template->fetch('listAll.tpl');
63 * Get absolute file name.
67 protected function getAbsFileName() {
68 return $this->config
->CoreDAOCodePath
. "AllCoreTables.data.php";
72 // * Get the checksum for the schema.
76 // protected function getSchemaChecksum() {
77 // if (!$this->checksum) {
78 // CRM_Utils_Array::flatten($this->tables, $flat);
80 // $this->checksum = md5(json_encode($flat));
82 // return $this->checksum;