Class CoughGeneratorConfig

Description

Config class for CoughGenerator.

It abstracts the implementation of configuration specification, as well as makes it easy for the CoughGenerator to perform different actions based on the user's configuration.

  • author: Anthony Bush

Located in /cough_generator/CoughGeneratorConfig.class.php (line 13)

CoughConfig
   |
   --CoughGeneratorConfig
Method Summary
static void constructFromFile ( $filePath)
mixed convertIdToEntityName ( $table,  $id)
void getBaseCollectionClassName ( $table)
void getBaseObjectClassName ( $table)
string getCamelCase (string $value)
void getClassFileName (CoughClass $class)
void getClassFilePath (CoughClass $class)
void getClassName ( $table)
string getEntityName ( $table)
void getForeignCollectionName ( $relationship,  $relationships)
void getForeignObjectName ( $relationship)
void getForeignTableAliasName ( $relationship)
array getIdRegex ( $table)
void getObjectExtensionClassName ( $table)
void getPhpdocAuthor ( $table)
void getPhpdocCopyright ( $table)
void getPhpdocPackage ( $table)
void getStarterObjectClassName ( $table)
void getTableNameWithoutPrefix ( $tableName,  $prefixes)
string getTitleCase (string $value)
void initConfig ()
void shouldGenerateForTable ( $table)
void shouldGenerateHasManyMethods ( $hasMany)
void shouldGenerateHasOneMethods ( $hasOne)
Variables

Inherited Variables

Inherited from CoughConfig

CoughConfig::$config
Methods
static method constructFromFile (line 15)
  • access: public
static void constructFromFile ( $filePath)
  • $filePath
convertIdToEntityName (line 194)

Converts an id field into an object name (in most cases this simply involves stripping off an "_id" suffix).

Example input -> output might be "billing_addres_id" -> "billing_address"

  • return: - string on successful conversion, false on failure
  • author: Anthony Bush
  • access: public
mixed convertIdToEntityName ( $table,  $id)
  • $table
  • $id
getBaseCollectionClassName (line 147)
  • access: public
void getBaseCollectionClassName ( $table)
getBaseObjectClassName (line 139)
  • access: public
void getBaseObjectClassName ( $table)
getCamelCase (line 427)

getCamelCase takes the given string and returns it in camelCase format, with underscores removed.

Example input: db_column_name Example output: dbColumnName

See: http://en.wikipedia.org/wiki/CamelCase

  • return: the camelCased version of the given string
  • author: Anthony Bush
  • access: public
string getCamelCase (string $value)
  • string $value: the string to convert to camel case, usually containing underscores
getClassFileName (line 117)
  • access: public
void getClassFileName (CoughClass $class)
getClassFilePath (line 109)
  • access: public
void getClassFilePath (CoughClass $class)
getClassName (line 86)
  • access: public
void getClassName ( $table)
getCollectionExtensionClassName (line 179)
  • access: public
void getCollectionExtensionClassName ( $table)
getEntityName (line 218)

Given a table object, it gets the "entity name", currently just strips any prefixes specified in the config from the table name, otherwise just returns the table name.

e.g. "cust_address" will get entity name "address" if strip_table_name_prefixes has 'cust_' in it.

  • author: Anthony Bush
  • access: public
string getEntityName ( $table)
getForeignCollectionName (line 282)
  • access: public
void getForeignCollectionName ( $relationship,  $relationships)
  • $relationship
  • $relationships
getForeignObjectName (line 277)
  • access: public
void getForeignObjectName ( $relationship)
getForeignTableAliasName (line 233)
  • access: public
void getForeignTableAliasName ( $relationship)
getIdRegex (line 326)

Returns an array of regexes to match against in order to determine if a field should be considered an ID field, in order of precedence.

  • author: Anthony Bush
  • access: public
array getIdRegex ( $table)
getObjectExtensionClassName (line 173)
  • access: public
void getObjectExtensionClassName ( $table)
getPhpdocAuthor (line 155)
  • access: public
void getPhpdocAuthor ( $table)
getPhpdocCopyright (line 167)
  • access: public
void getPhpdocCopyright ( $table)
getPhpdocPackage (line 161)
  • access: public
void getPhpdocPackage ( $table)
getStarterCollectionClassName (line 131)
  • access: public
void getStarterCollectionClassName ( $table)
getStarterObjectClassName (line 123)
  • access: public
void getStarterObjectClassName ( $table)
getTableNameWithoutPrefix (line 98)
  • access: public
void getTableNameWithoutPrefix ( $tableName,  $prefixes)
  • $tableName
  • $prefixes
getTitleCase (line 407)

getTitleCase() takes the given string and returns it in TitleCase format (sometimes called UpperCamelCase), with underscores removed.

Example input: db_column_name Example output: DbColumnName

  • return: the TitleCased version of the given string
  • author: Anthony Bush
  • access: public
string getTitleCase (string $value)
  • string $value: the string to convert to title case, usually containing underscores
initConfig (line 20)
  • access: protected
void initConfig ()

Redefinition of:
CoughConfig::initConfig()
Initializes config to the defaults
shouldGenerateForTable (line 347)
  • access: public
void shouldGenerateForTable ( $table)
shouldGenerateHasManyMethods (line 375)
  • access: public
void shouldGenerateHasManyMethods ( $hasMany)
shouldGenerateHasOneMethods (line 354)
  • access: public
void shouldGenerateHasOneMethods ( $hasOne)
shouldGenerateLoadSqlInnerJoins (line 336)
  • access: public
void shouldGenerateLoadSqlInnerJoins ( $table)

Inherited Methods

Inherited From CoughConfig

CoughConfig::__construct()
CoughConfig::getArrayValueFromMultiKey()
CoughConfig::getConfigValue()
CoughConfig::initConfig()
CoughConfig::mergeIntoConfig()
Class Constants

Documentation generated on Wed, 12 Nov 2008 21:56:16 -0600 by phpDocumentor 1.4.0