本文整理汇总了PHP中Doctrine_Table::addGenerator方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Table::addGenerator方法的具体用法?PHP Doctrine_Table::addGenerator怎么用?PHP Doctrine_Table::addGenerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Table
的用法示例。
在下文中一共展示了Doctrine_Table::addGenerator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* initialize
*
* Initialize the plugin. Call in Doctrine_Template setTableDefinition() in order to initiate a generator in a template
* SEE: Doctrine_Template_I18n for an example
*
* @param Doctrine_Table $table
* @return void
*/
public function initialize(Doctrine_Table $table)
{
if ($this->_initialized) {
return false;
}
$this->_initialized = true;
$this->initOptions();
$table->addGenerator($this, get_class($this));
$this->_options['table'] = $table;
$this->_options['className'] = str_replace('%CLASS%', $this->_options['table']->getComponentName(), $this->_options['className']);
// check that class doesn't exist (otherwise we cannot create it)
if ($this->_options['generateFiles'] === false && class_exists($this->_options['className'], false)) {
return false;
}
$this->buildTable();
$fk = $this->buildForeignKeys($this->_options['table']);
$this->_table->setColumns($fk);
$this->buildRelation();
$this->setTableDefinition();
$this->setUp();
$definition = array();
$definition['columns'] = $this->_table->getColumns();
$definition['tableName'] = $this->_table->getTableName();
$definition['actAs'] = $this->_table->getTemplates();
$this->generateClass($definition);
$this->buildChildDefinitions();
$this->_table->initIdentifier();
}
示例2: initialize
/**
* Initialize the plugin. Call in Doctrine_Template setTableDefinition() in order to initiate a generator in a template
*
* @see Doctrine_Template_I18n
* @param Doctrine_Table $table
* @return void
*/
public function initialize(Doctrine_Table $table)
{
if ($this->_initialized) {
return false;
}
$this->_initialized = true;
$this->initOptions();
$table->addGenerator($this, get_class($this));
$this->_options['table'] = $table;
$ownerClassName = $this->_options['table']->getComponentName();
$className = $this->_options['className'];
$this->_options['className'] = str_replace('%CLASS%', $ownerClassName, $className);
if (isset($this->_options['tableName'])) {
$ownerTableName = $this->_options['table']->getTableName();
$tableName = $this->_options['tableName'];
$this->_options['tableName'] = str_replace('%TABLE%', $ownerTableName, $tableName);
}
// check that class doesn't exist (otherwise we cannot create it)
if ($this->_options['generateFiles'] === false && class_exists($this->_options['className'])) {
$this->_table = Doctrine_Core::getTable($this->_options['className']);
return false;
}
$this->buildTable();
$fk = $this->buildForeignKeys($this->_options['table']);
$this->_table->setColumns($fk);
$this->buildRelation();
$this->setTableDefinition();
$this->setUp();
$this->generateClassFromTable($this->_table);
$this->buildChildDefinitions();
$this->_table->initIdentifier();
}
示例3: initialize
/**
* Initialize the plugin. Call in Doctrine_Template setTableDefinition() in order to initiate a generator in a template
*
* @see Doctrine_Template_I18n
* @param Doctrine_Table $table
* @return void
*/
public function initialize(Doctrine_Table $table)
{
if ($this->_initialized) {
return false;
}
$this->_initialized = true;
$this->initOptions();
$table->addGenerator($this, get_class($this));
$this->_options['table'] = $table;
$ownerClassName = $this->_options['table']->getComponentName();
$className = $this->_options['className'];
$this->_options['className'] = str_replace('%CLASS%', $ownerClassName, $className);
if (isset($this->_options['tableName'])) {
$ownerTableName = $this->_options['table']->getTableName();
$tableName = $this->_options['tableName'];
$this->_options['tableName'] = str_replace('%TABLE%', $ownerTableName, $tableName);
}
$currentTableHash = spl_object_hash($table);
if (!empty(self::$initializedTables[$currentTableHash])) {
return null;
}
self::$initializedTables[$currentTableHash] = true;
$this->buildTable();
$fk = $this->buildForeignKeys($this->_options['table']);
$this->_table->setColumns($fk);
$this->buildRelation();
$this->setTableDefinition();
$this->setUp();
if ($this->_options['generateFiles'] === true || !class_exists($this->_options['className'])) {
$this->generateClassFromTable($this->_table);
}
$this->buildChildDefinitions();
$this->_table->initIdentifier();
}