Commit | Line | Data |
---|---|---|
5e434adf ARW |
1 | <?php |
2 | ||
3 | /** | |
4 | * Create DAO ORM classes. | |
5 | */ | |
6 | class CRM_Core_CodeGen_DAO extends CRM_Core_CodeGen_BaseTask { | |
7 | function run() { | |
8 | $this->generateDAOs(); | |
9 | } | |
10 | ||
11 | function generateDAOs() { | |
12 | foreach (array_keys($this->tables) as $name) { | |
13 | echo "Generating $name as " . $this->tables[$name]['fileName'] . "\n"; | |
14 | ||
15 | if (empty($this->tables[$name]['base'])) { | |
16 | echo "No base defined for $name, skipping output generation\n"; | |
17 | continue; | |
18 | } | |
19 | ||
20 | $template = new CRM_Core_CodeGen_Util_Template('php'); | |
21 | $template->assign('table', $this->tables[$name]); | |
22 | ||
23 | $directory = $this->config->phpCodePath . $this->tables[$name]['base']; | |
24 | CRM_Core_CodeGen_Util_File::createDir($directory); | |
25 | ||
26 | $template->run('dao.tpl', $directory . $this->tables[$name]['fileName']); | |
27 | } | |
28 | } | |
29 | } |