CRM_Core_CodeGen_DAO
extends CRM_Core_CodeGen_BaseTask
in package
Create DAO ORM classes.
Table of Contents
Properties
- $name : string
- $config : CRM_Core_CodeGen_Main
- $tables : mixed
- $ext : mixed
- $raw : string
- $tableChecksum : string
- $tsFunctionName : string
- $useHelper : mixed
Methods
- __construct() : mixed
- CRM_Core_CodeGen_DAO constructor.
- getAbsFileName() : string
- Get the absolute file name.
- getRaw() : string
- Generate the raw PHP code for the DAO.
- getRelFileName() : string
- Get relative file name.
- needsUpdate() : bool
- run() : mixed
- Run generator.
- setConfig() : mixed
- TODO: this is the most rudimentary possible hack. CG config should eventually be made into a first-class object.
- extractRegex() : string|null
- Extract a single regex from a file.
- getTableChecksum() : string
- Get a unique signature for the table/schema.
- isApproxPhpMatch() : bool
- Determine if two snippets of PHP code are approximately equivalent.
- getTemplate() : CRM_Core_CodeGen_Util_Template
Properties
$name
public
string
$name
$config
protected
CRM_Core_CodeGen_Main
$config
$tables
protected
mixed
$tables
$ext
private
mixed
$ext
= "'civicrm'"
$raw
private
string
$raw
$tableChecksum
private
string
$tableChecksum
$tsFunctionName
private
string
$tsFunctionName
translate function name
$useHelper
private
mixed
$useHelper
= ''
Methods
__construct()
CRM_Core_CodeGen_DAO constructor.
public
__construct(CRM_Core_CodeGen_Main $config, string $name[, string $tsFunctionName = 'ts' ]) : mixed
Parameters
- $config : CRM_Core_CodeGen_Main
- $name : string
- $tsFunctionName : string = 'ts'
getAbsFileName()
Get the absolute file name.
public
getAbsFileName() : string
Return values
stringgetRaw()
Generate the raw PHP code for the DAO.
public
getRaw() : string
Return values
stringgetRelFileName()
Get relative file name.
public
getRelFileName() : string
Return values
stringneedsUpdate()
public
needsUpdate() : bool
Return values
bool —TRUE if an update is needed.
run()
Run generator.
public
run() : mixed
setConfig()
TODO: this is the most rudimentary possible hack. CG config should eventually be made into a first-class object.
public
setConfig(object $config) : mixed
Parameters
- $config : object
extractRegex()
Extract a single regex from a file.
protected
static extractRegex(string $file, string $regex) : string|null
Parameters
- $file : string
-
File name
- $regex : string
-
A pattern to match. Ex: "foo=([a-z]+)".
Return values
string|null —The value matched.
getTableChecksum()
Get a unique signature for the table/schema.
protected
getTableChecksum() : string
Return values
stringisApproxPhpMatch()
Determine if two snippets of PHP code are approximately equivalent.
protected
isApproxPhpMatch(mixed $actual, mixed $expected) : bool
This includes exceptions to equivalence for (a) whitespace and (b) the token "GenCodeChecksum".
This is useful for determining if someone has manually mucked with one the files. However, it's not perfect -- because whitespace changes are not detected. Hence, it's good to use in combination with another heuristic.
Parameters
- $actual : mixed
- $expected : mixed
Return values
boolgetTemplate()
private
getTemplate() : CRM_Core_CodeGen_Util_Template