Merge pull request #13971 from eileenmcnaughton/array_format_4
[civicrm-core.git] / CRM / Core / CodeGen / Reflection.php
CommitLineData
5e434adf
ARW
1<?php
2
3/**
4 * Create classes which are used for schema introspection.
5 */
6class CRM_Core_CodeGen_Reflection extends CRM_Core_CodeGen_BaseTask {
4ef04170 7
4ef04170
TO
8 /**
9 * @return bool
10 * TRUE if an update is needed.
11 */
12 public function needsUpdate() {
5079ecb1
TO
13 // Generating this file is fairly cheap, and we don't have robust heuristic
14 // for the checksum.
acc660f4 15
16 // skip this task on test environment as the schema generation should only be triggered during installation/upgrade
17 if (CIVICRM_UF == 'UnitTests') {
18 return FALSE;
19 }
20
187c1c7c 21 return TRUE;
5e434adf
ARW
22 }
23
8246bca4 24 /**
25 * Run generator.
26 */
4ef04170
TO
27 public function run() {
28 echo "Generating table list\n";
8fe9ce40 29 $template = new CRM_Core_CodeGen_Util_Template('php', FALSE);
5e434adf 30 $template->assign('tables', $this->tables);
5079ecb1 31 $template->assign('genCodeChecksum', 'IGNORE');
4ef04170
TO
32 $template->run('listAll.tpl', $this->getAbsFileName());
33 }
34
35 /**
8246bca4 36 * Get absolute file name.
37 *
4ef04170
TO
38 * @return string
39 */
40 protected function getAbsFileName() {
41 return $this->config->CoreDAOCodePath . "AllCoreTables.data.php";
42 }
5e434adf 43
5e434adf 44}