本文整理汇总了PHP中Doctrine_Import_Builder::buildDefinition方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Import_Builder::buildDefinition方法的具体用法?PHP Doctrine_Import_Builder::buildDefinition怎么用?PHP Doctrine_Import_Builder::buildDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Import_Builder
的用法示例。
在下文中一共展示了Doctrine_Import_Builder::buildDefinition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateClass
/**
* Generates the class definition for plugin class
*
* @param array $definition Definition array defining columns, relations and options
* for the model
* @return void
*/
public function generateClass(array $definition = array())
{
$definition['className'] = $this->_options['className'];
$definition['toString'] = isset($this->_options['toString']) ? $this->_options['toString'] : false;
if (isset($this->_options['listeners'])) {
$definition['listeners'] = $this->_options['listeners'];
}
$builder = new Doctrine_Import_Builder();
$builderOptions = isset($this->_options['builderOptions']) ? (array) $this->_options['builderOptions'] : array();
$builder->setOptions($builderOptions);
if ($this->_options['generateFiles']) {
if (isset($this->_options['generatePath']) && $this->_options['generatePath']) {
$builder->setTargetPath($this->_options['generatePath']);
$builder->buildRecord($definition);
} else {
throw new Doctrine_Record_Exception('If you wish to generate files then you must specify the path to generate the files in.');
}
} else {
$def = $builder->buildDefinition($definition);
eval($def);
}
}
示例2: generateClass
/**
* generates the class definition for plugin class
*
* @param array $columns the plugin class columns, keys representing the column names
* and values as column definitions
*
* @param array $relations the bound relations of the plugin class
*
* @param array $options plugin class options, keys representing the option names
* and values as option values
* @return void
*/
public function generateClass(array $columns = array(), array $relations = array(), array $options = array())
{
$options['className'] = $this->_options['className'];
$builder = new Doctrine_Import_Builder();
if ($this->_options['generateFiles']) {
if (isset($this->_options['generatePath']) && $this->_options['generatePath']) {
$builder->setTargetPath($this->_options['generatePath']);
$builder->buildRecord($options, $columns, $relations);
} else {
throw new Doctrine_Plugin_Exception('If you wish to generate files then you must specify the path to generate the files in.');
}
} else {
$def = $builder->buildDefinition($options, $columns, $relations);
eval($def);
}
}