Class jDaoGenerator

Description

This is a generator which creates php class from dao xml file.

It is called by jDaoCompiler

Located in /dao/jDaoGenerator.class.php (line 28)


	
			
Direct descendents
Class Description
mysqlDaoBuilder driver for jDaoCompiler
intuitionDaoBuilder driver for jDaoCompiler
ociDaoBuilder driver for jDaoCompiler
sqliteDaoBuilder driver for jDaoCompiler
pgsqlDaoBuilder driver for jDaoCompiler
mssqlDaoBuilder driver for jDaoCompiler
Variable Summary
Method Summary
jDaoGenerator __construct ( $selector,  $tools,  $daoParser, jDaoParser $daoDefinition)
void buildClasses ()
string buildConditions (jDaoConditions $cond, array $fields, [array $params = array()], [boolean $withPrefix = true], [array $groupby = null])
void buildCountUserQuery ( $method,  &$src,  &$allField)
void buildDeleteUserQuery ( $method,  &$src,  &$primaryFields)
void buildEndOfClass ()
string buildInsertMethod ( $pkFields)
string buildOneSQLCondition ( $condition, array $fields, array $params, boolean $withPrefix, [boolean $principal = false], jDaoCondition $cond)
array buildOuterJoins ( &$tables,  $primaryTableName)
string buildSelectClause ([ $distinct = false])
void buildSelectPattern ( $pattern,  $table,  $fieldname,  $propname)
void buildSelectUserQuery ( $method,  &$src,  &$allField)
string buildSimpleConditions ( &$fields, [string $fieldPrefix = ''], [boolean $forSelect = true], array $fields)
string buildUpdateMethod ( $pkFields)
void buildUpdateUserQuery ( $method,  &$src,  &$primaryFields)
string buildUserMethods ()
void getAutoIncrementPKField ([ $using = null])
void _captureAll ( &$field)
void _captureBinaryField ( &$field)
void _captureFieldToUpdate ( &$field)
void _capturePrimaryTable ( &$field)
void _encloseName ( $name)
void _getPropertiesBy ( $captureMethod)
void _preparePHPCallbackExpr ( $field)
void _preparePHPExpr ( $expr,  $field, [ $checknull = true], [ $forCondition = ''])
void _prepareValues ( $fieldList, [ $pattern = ''], [ $prefixfield = ''])
void _writeFieldNamesWith ([ $start = ''], [ $end = ''], [ $beetween = ''], [ $using = null])
void _writeFieldsInfoWith (string $info, [string $start = ''], [string $end = ''], [string $beetween = ''], [array $using = null])
Variables
mixed $aliasWord = ' AS ' (line 50)
  • access: protected

Redefined in descendants as:
mixed $sqlFromClause = '' (line 74)
  • access: protected
mixed $sqlSelectClause = '' (line 76)
  • access: protected
mixed $sqlWhereClause = '' (line 72)
  • access: protected
mixed $tableRealName = '' (line 64)

the real name of the main table

  • access: protected
mixed $tableRealNameEsc = '' (line 70)

the real name of the main table, escaped in SQL so it is ready to include into a SQL query.

  • access: protected
jDbTools $tools (line 55)
  • access: protected
string $_DaoClassName = null (line 46)

the DAO classname

  • access: protected
mixed $_daoId (line 57)
  • access: protected
mixed $_daoPath (line 58)
  • access: protected
string $_DaoRecordClassName = null (line 40)

The DaoRecord ClassName

  • access: protected
jDaoParser $_dataParser = null (line 34)

the dao definition.

  • access: protected
mixed $_dbType (line 59)
  • access: protected
Methods
Constructor __construct (line 82)

constructor

jDaoGenerator __construct ( $selector,  $tools,  $daoParser, jDaoParser $daoDefinition)
  • jDaoParser $daoDefinition
  • $selector
  • $tools
  • $daoParser
buildClasses (line 95)

build all classes

  • access: public
void buildClasses ()
buildConditions (line 860)

build 'where' clause from conditions declared with condition tag in a user method

  • return: a WHERE clause (without the WHERE keyword) with eventually an ORDER clause
  • access: protected
string buildConditions (jDaoConditions $cond, array $fields, [array $params = array()], [boolean $withPrefix = true], [array $groupby = null])
  • jDaoConditions $cond: the condition object which contains conditions data
  • array $fields: array of jDaoProperty
  • array $params: list of parameters name of the method
  • boolean $withPrefix: true if the field name should be preceded by the table name/table alias
  • array $groupby: list of properties to use in a groupby
buildCountUserQuery (line 520)
  • access: protected
void buildCountUserQuery ( $method,  &$src,  &$allField)
  • $method
  • &$src
  • &$allField

Redefined in descendants as:
buildDeleteUserQuery (line 465)
  • access: protected
void buildDeleteUserQuery ( $method,  &$src,  &$primaryFields)
  • $method
  • &$src
  • &$primaryFields
buildEndOfClass (line 662)
  • access: protected
void buildEndOfClass ()

Redefined in descendants as:
buildFromWhereClause (line 570)

create FROM clause and WHERE clause for all SELECT query

  • access: protected
void buildFromWhereClause ()
buildInsertMethod (line 214)

build the insert() method in the final class

  • return: the source of the method
  • access: protected
string buildInsertMethod ( $pkFields)
  • $pkFields
buildOneSQLCondition (line 919)

build a condition for the SQL WHERE clause.

this method call itself recursively.

  • return: a WHERE clause (without the WHERE keyword)
  • see: jDaoGenerator::buildConditions
  • access: protected
string buildOneSQLCondition ( $condition, array $fields, array $params, boolean $withPrefix, [boolean $principal = false], jDaoCondition $cond)
  • jDaoCondition $cond: a condition object which contains conditions data
  • array $fields: array of jDaoProperty
  • array $params: list of parameters name of the method
  • boolean $withPrefix: true if the field name should be preceded by the table name/table alias
  • boolean $principal: should be true for the first call, and false for recursive call
  • $condition
buildOuterJoins (line 604)

generates the part of the FROM clause for outer joins

  • return: [0]=> the part of the FROM clause, [1]=> the part to add to the WHERE clause when needed
  • access: protected
array buildOuterJoins ( &$tables,  $primaryTableName)
  • &$tables
  • $primaryTableName

Redefined in descendants as:
buildSelectClause (line 631)

build a SELECT clause for all SELECT queries

  • return: the select clause.
  • access: protected
string buildSelectClause ([ $distinct = false])
  • $distinct
buildSelectPattern (line 650)

build an item for the select clause

  • access: protected
void buildSelectPattern ( $pattern,  $table,  $fieldname,  $propname)
  • $pattern
  • $table
  • $fieldname
  • $propname

Redefined in descendants as:
buildSelectUserQuery (line 544)
  • access: protected
void buildSelectUserQuery ( $method,  &$src,  &$allField)
  • $method
  • &$src
  • &$allField
buildSimpleConditions (line 801)

build a WHERE clause with conditions on given properties : conditions are equality between a variable and the field.

the variable name is the name of the property, made with an optional prefix given in $fieldPrefix parameter. This method is called to generate WHERE clause for primary keys.

  • return: the WHERE clause (without the WHERE keyword)
  • access: protected
string buildSimpleConditions ( &$fields, [string $fieldPrefix = ''], [boolean $forSelect = true], array $fields)
  • array $fields: list of jDaoPropery objects
  • string $fieldPrefix: an optional prefix to prefix variable names
  • boolean $forSelect: if true, the table name or table alias will prefix the field name in the query
  • &$fields
buildUpdateAutoIncrementPK (line 1079)
  • access: protected
void buildUpdateAutoIncrementPK ( $pkai)
  • $pkai

Redefined in descendants as:
buildUpdateMethod (line 303)

build the update() method for the final class

  • return: the source of the method
  • access: protected
string buildUpdateMethod ( $pkFields)
  • $pkFields
buildUpdateUserQuery (line 478)
  • access: protected
void buildUpdateUserQuery ( $method,  &$src,  &$primaryFields)
  • $method
  • &$src
  • &$primaryFields
buildUserMethods (line 364)

build all methods defined by the developer in the dao file

  • return: the source of the methods
  • access: protected
string buildUserMethods ()
getAutoIncrementPKField (line 770)

get autoincrement PK field

  • access: protected
void getAutoIncrementPKField ([ $using = null])
  • $using

Redefined in descendants as:
_captureAll (line 745)
  • access: protected
void _captureAll ( &$field)
  • &$field
_captureBinaryField (line 763)
  • access: protected
void _captureBinaryField ( &$field)
  • &$field
_captureFieldToUpdate (line 749)
  • access: protected
void _captureFieldToUpdate ( &$field)
  • &$field
_captureFieldToUpdateOnUpdate (line 756)
  • access: protected
void _captureFieldToUpdateOnUpdate ( &$field)
  • &$field
_capturePrimaryFieldsExcludeAutoIncrement (line 733)
  • access: protected
void _capturePrimaryFieldsExcludeAutoIncrement ( &$field)
  • &$field
_capturePrimaryFieldsExcludePk (line 737)
  • access: protected
void _capturePrimaryFieldsExcludePk ( &$field)
  • &$field
_capturePrimaryTable (line 741)
  • access: protected
void _capturePrimaryTable ( &$field)
  • &$field
_encloseName (line 1075)
  • access: protected
void _encloseName ( $name)
  • $name

Redefined in descendants as:
_getPrimaryFieldsList (line 699)
  • access: protected
void _getPrimaryFieldsList ()
_getPropertiesBy (line 721)

gets fields that match a condition returned by the $captureMethod

  • access: protected
void _getPropertiesBy ( $captureMethod)
  • $captureMethod
_preparePHPCallbackExpr (line 1054)
  • access: protected
void _preparePHPCallbackExpr ( $field)
  • $field
_preparePHPExpr (line 995)
  • access: protected
void _preparePHPExpr ( $expr,  $field, [ $checknull = true], [ $forCondition = ''])
  • $expr
  • $field
  • $checknull
  • $forCondition
_prepareValues (line 828)
  • access: protected
void _prepareValues ( $fieldList, [ $pattern = ''], [ $prefixfield = ''])
  • $fieldList
  • $pattern
  • $prefixfield
_writeFieldNamesWith (line 695)

format field names with start, end and between strings.

  • access: protected
void _writeFieldNamesWith ([ $start = ''], [ $end = ''], [ $beetween = ''], [ $using = null])
  • $start
  • $end
  • $beetween
  • $using
_writeFieldsInfoWith (line 678)

format field names with start, end and between strings.

will write the field named info. eg info == name echo $field->name

void _writeFieldsInfoWith (string $info, [string $start = ''], [string $end = ''], [string $beetween = ''], [array $using = null])
  • string $info: property to get from objects in $using
  • string $start: string to add before the info
  • string $end: string to add after the info
  • string $beetween: string to add between each info
  • array $using: list of CopixPropertiesForDAO object. if null, get default fields list

Documentation generated on Thu, 19 Sep 2013 00:03:20 +0200 by phpDocumentor 1.4.3