jDaoGenerator
in package
This is a generator which creates php class from dao xml file.
It is called by jDaoCompiler
Tags
Table of Contents
- $_DaoClassName : string
- the DAO classname.
- $_daoId : mixed
- $_daoPath : mixed
- $_DaoRecordClassName : string
- The DaoRecord ClassName.
- $_dataParser : jDaoParser
- the dao definition.
- $_dbType : mixed
- $aliasWord : mixed
- $propertiesListForInsert : mixed
- $sqlFromClause : mixed
- $sqlSelectClause : mixed
- $sqlWhereClause : mixed
- $tableRealName : mixed
- the real name of the main table.
- $tableRealNameEsc : mixed
- the real name of the main table, escaped in SQL so it is ready to include into a SQL query.
- $tools : jDbTools
- __construct() : mixed
- constructor.
- buildClasses() : mixed
- build all classes.
- _captureAll() : mixed
- _captureBinaryField() : mixed
- _captureFieldToUpdate() : mixed
- _captureFieldToUpdateOnUpdate() : mixed
- _capturePrimaryFieldsExcludeAutoIncrement() : mixed
- _capturePrimaryFieldsExcludePk() : mixed
- _capturePrimaryTable() : mixed
- _encloseName() : mixed
- _getPrimaryFieldsList() : mixed
- _preparePHPCallbackExpr() : mixed
- _preparePHPExpr() : string
- _prepareValues() : array<string|int, array<string|int, mixed>>
- _writeFieldNamesWith() : mixed
- format field names with start, end and between strings.
- _writeFieldsInfoWith() : string
- format field names with a start, an end and a between strings.
- buildCountUserQuery() : mixed
- buildDeleteUserQuery() : mixed
- buildEndOfClass() : mixed
- buildFromWhereClause() : mixed
- create FROM clause and WHERE clause for all SELECT query.
- buildInsertMethod() : string
- build the insert() method in the final class.
- buildOuterJoins() : array<string|int, mixed>
- generates the part of the FROM clause for outer joins.
- buildSelectClause() : string
- build a SELECT clause for all SELECT queries.
- buildSelectPattern() : mixed
- build an item for the select clause.
- buildSelectUserQuery() : mixed
- buildUpdateAutoIncrementPK() : mixed
- buildUpdateMethod() : string
- build the update() method for the final class.
- buildUpdateUserQuery() : mixed
- buildUserMethods() : string
- build all methods defined by the developer in the dao file.
- getAutoIncrementPKField() : mixed
- get autoincrement PK field.
- parseSQLFunction() : mixed
Properties
$_DaoClassName
the DAO classname.
protected
string
$_DaoClassName
Tags
$_daoId
protected
mixed
$_daoId
Tags
$_daoPath
protected
mixed
$_daoPath
Tags
$_DaoRecordClassName
The DaoRecord ClassName.
protected
string
$_DaoRecordClassName
Tags
$_dataParser
the dao definition.
protected
jDaoParser
$_dataParser
Tags
$_dbType
protected
mixed
$_dbType
Tags
$aliasWord
protected
mixed
$aliasWord
= ' AS '
Tags
$propertiesListForInsert
protected
mixed
$propertiesListForInsert
= 'PrimaryTable'
Tags
$sqlFromClause
protected
mixed
$sqlFromClause
= ''
Tags
$sqlSelectClause
protected
mixed
$sqlSelectClause
= ''
Tags
$sqlWhereClause
protected
mixed
$sqlWhereClause
= ''
Tags
$tableRealName
the real name of the main table.
protected
mixed
$tableRealName
= ''
Tags
$tableRealNameEsc
the real name of the main table, escaped in SQL so it is ready to include into a SQL query.
protected
mixed
$tableRealNameEsc
= ''
Tags
$tools
protected
jDbTools
$tools
Tags
Methods
__construct()
constructor.
public
__construct(jSelectorDao $selector, jDbTools $tools, jDaoParser $daoParser) : mixed
Parameters
- $selector : jSelectorDao
- $tools : jDbTools
- $daoParser : jDaoParser
Tags
Return values
mixed —buildClasses()
build all classes.
public
buildClasses() : mixed
Tags
Return values
mixed —_captureAll()
protected
_captureAll(mixed &$field) : mixed
Parameters
- $field : mixed
Tags
Return values
mixed —_captureBinaryField()
protected
_captureBinaryField(mixed &$field) : mixed
Parameters
- $field : mixed
Tags
Return values
mixed —_captureFieldToUpdate()
protected
_captureFieldToUpdate(mixed &$field) : mixed
Parameters
- $field : mixed
Tags
Return values
mixed —_captureFieldToUpdateOnUpdate()
protected
_captureFieldToUpdateOnUpdate(mixed &$field) : mixed
Parameters
- $field : mixed
Tags
Return values
mixed —_capturePrimaryFieldsExcludeAutoIncrement()
protected
_capturePrimaryFieldsExcludeAutoIncrement(mixed &$field) : mixed
Parameters
- $field : mixed
Tags
Return values
mixed —_capturePrimaryFieldsExcludePk()
protected
_capturePrimaryFieldsExcludePk(mixed &$field) : mixed
Parameters
- $field : mixed
Tags
Return values
mixed —_capturePrimaryTable()
protected
_capturePrimaryTable(mixed &$field) : mixed
Parameters
- $field : mixed
Tags
Return values
mixed —_encloseName()
protected
_encloseName(mixed $name) : mixed
Parameters
- $name : mixed
Tags
Return values
mixed —_getPrimaryFieldsList()
protected
_getPrimaryFieldsList() : mixed
Tags
Return values
mixed —_preparePHPCallbackExpr()
protected
_preparePHPCallbackExpr(mixed $field) : mixed
Parameters
- $field : mixed
Tags
Return values
mixed —_preparePHPExpr()
protected
_preparePHPExpr(string $expr, jDaoProperty $field[, bool $checknull = true ][, string $forCondition = '' ]) : string
Parameters
- $expr : string
- $field : jDaoProperty
- $checknull : bool = true
- $forCondition : string = ''
Tags
Return values
string —the PHP expression to insert into the generated class
_prepareValues()
protected
_prepareValues(array<string|int, jDaoProperty> $fieldList[, string $pattern = '' ][, string $prefixfield = '' ]) : array<string|int, array<string|int, mixed>>
Parameters
- $fieldList : array<string|int, jDaoProperty>
- $pattern : string = ''
- $prefixfield : string = ''
Tags
Return values
array<string|int, array<string|int, mixed>> —_writeFieldNamesWith()
format field names with start, end and between strings.
protected
_writeFieldNamesWith([mixed $start = '' ][, mixed $end = '' ][, mixed $beetween = '' ][, null|mixed $using = null ]) : mixed
Parameters
- $start : mixed = ''
- $end : mixed = ''
- $beetween : mixed = ''
- $using : null|mixed = null
Tags
Return values
mixed —_writeFieldsInfoWith()
format field names with a start, an end and a between strings.
protected
_writeFieldsInfoWith(string $info[, string $start = '' ][, string $end = '' ][, string $beetween = '' ][, array<string|int, jDaoProperty> $using = null ]) : string
ex: give 'name' as $info, it will output the result of $field->name
Parameters
- $info : string
-
property to get from objects in $using
- $start : string = ''
-
string to add before the info
- $end : string = ''
-
string to add after the info
- $beetween : string = ''
-
string to add between each info
- $using : array<string|int, jDaoProperty> = null
-
list of jDaoProperty object. if null, get default fields list
Tags
Return values
string —list of field names separated by the $between character
buildCountUserQuery()
protected
buildCountUserQuery(mixed $method, mixed &$src, mixed &$allField) : mixed
Parameters
- $method : mixed
- $src : mixed
- $allField : mixed
Tags
Return values
mixed —buildDeleteUserQuery()
protected
buildDeleteUserQuery(mixed $method, mixed &$src, mixed &$primaryFields) : mixed
Parameters
- $method : mixed
- $src : mixed
- $primaryFields : mixed
Tags
Return values
mixed —buildEndOfClass()
protected
buildEndOfClass() : mixed
Tags
Return values
mixed —buildFromWhereClause()
create FROM clause and WHERE clause for all SELECT query.
protected
buildFromWhereClause() : mixed
Tags
Return values
mixed —buildInsertMethod()
build the insert() method in the final class.
protected
buildInsertMethod(mixed $pkFields) : string
Parameters
- $pkFields : mixed
Tags
Return values
string —the source of the method
buildOuterJoins()
generates the part of the FROM clause for outer joins.
protected
buildOuterJoins(mixed &$tables, mixed $primaryTableName) : array<string|int, mixed>
Parameters
- $tables : mixed
- $primaryTableName : mixed
Tags
Return values
array<string|int, mixed> —[0]=> the part of the FROM clause, [1]=> the part to add to the WHERE clause when needed
buildSelectClause()
build a SELECT clause for all SELECT queries.
protected
buildSelectClause([mixed $distinct = false ]) : string
Parameters
- $distinct : mixed = false
Tags
Return values
string —the select clause
buildSelectPattern()
build an item for the select clause.
protected
buildSelectPattern(mixed $pattern, mixed $table, mixed $fieldname, mixed $propname) : mixed
Parameters
- $pattern : mixed
- $table : mixed
- $fieldname : mixed
- $propname : mixed
Tags
Return values
mixed —buildSelectUserQuery()
protected
buildSelectUserQuery(mixed $method, mixed &$src, mixed &$allField) : mixed
Parameters
- $method : mixed
- $src : mixed
- $allField : mixed
Tags
Return values
mixed —buildUpdateAutoIncrementPK()
protected
buildUpdateAutoIncrementPK(mixed $pkai) : mixed
Parameters
- $pkai : mixed
Tags
Return values
mixed —buildUpdateMethod()
build the update() method for the final class.
protected
buildUpdateMethod(mixed $pkFields) : string
Parameters
- $pkFields : mixed
Tags
Return values
string —the source of the method
buildUpdateUserQuery()
protected
buildUpdateUserQuery(mixed $method, mixed &$src, mixed &$primaryFields) : mixed
Parameters
- $method : mixed
- $src : mixed
- $primaryFields : mixed
Tags
Return values
mixed —buildUserMethods()
build all methods defined by the developer in the dao file.
protected
buildUserMethods() : string
Tags
Return values
string —the source of the methods
getAutoIncrementPKField()
get autoincrement PK field.
protected
getAutoIncrementPKField([null|mixed $using = null ]) : mixed
Parameters
- $using : null|mixed = null
Tags
Return values
mixed —parseSQLFunction()
protected
parseSQLFunction(mixed $expression) : mixed
Parameters
- $expression : mixed