class CRM_Core_CodeGen_DAO extends CRM_Core_CodeGen_BaseTask

Create DAO ORM classes.

Properties

protected CRM_Core_CodeGen_Main $config from CRM_Core_CodeGen_BaseTask
protected $tables from CRM_Core_CodeGen_BaseTask
string $name

Methods

__construct(CRM_Core_CodeGen_Main $config, string $name)

CRM_Core_CodeGen_DAO constructor.

setConfig(object $config)

TODO: this is the most rudimentary possible hack. CG config should eventually be made into a first-class object.

bool
needsUpdate()

No description

static string|NULL
extractRegex(string $file, string $regex)

Extract a single regex from a file.

bool
isApproxPhpMatch($actual, $expected)

Determine if two snippets of PHP code are approximately equivalent.

run()

Run generator.

string
getRaw()

Generate the raw PHP code for the DAO.

string
getRelFileName()

Get relative file name.

string
getAbsFileName()

Get the absolute file name.

string
getTableChecksum()

Get a unique signature for the table/schema.

Details

at line 29
__construct(CRM_Core_CodeGen_Main $config, string $name)

CRM_Core_CodeGen_DAO constructor.

Parameters

CRM_Core_CodeGen_Main $config
string $name

setConfig(object $config)

TODO: this is the most rudimentary possible hack. CG config should eventually be made into a first-class object.

Parameters

object $config

at line 38
bool needsUpdate()

Return Value

bool TRUE if an update is needed.

static protected string|NULL extractRegex(string $file, string $regex)

Extract a single regex from a file.

Parameters

string $file File name
string $regex A pattern to match. Ex: "foo=([a-z]+)".

Return Value

string|NULL The value matched.

protected bool isApproxPhpMatch($actual, $expected)

Determine if two snippets of PHP code are approximately equivalent.

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
$expected

Return Value

bool

at line 55
run()

Run generator.

at line 80
string getRaw()

Generate the raw PHP code for the DAO.

Return Value

string

at line 101
string getRelFileName()

Get relative file name.

Return Value

string

at line 110
string getAbsFileName()

Get the absolute file name.

Return Value

string

at line 122
protected string getTableChecksum()

Get a unique signature for the table/schema.

Return Value

string