本文整理汇总了PHP中Propel\Generator\Util\QuickBuilder::setConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP QuickBuilder::setConfig方法的具体用法?PHP QuickBuilder::setConfig怎么用?PHP QuickBuilder::setConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Util\QuickBuilder
的用法示例。
在下文中一共展示了QuickBuilder::setConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
if (!class_exists('TableWithStateMachineBehavior')) {
$schema = <<<EOF
<database name="state_machine_behavior" defaultIdMethod="native">
<table name="table_with_state_machine_behavior">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<behavior name="state_machine">
<parameter name="states" value="draft, unpublished, published" />
<parameter name="initial_state" value="draft" />
<parameter name="transition" value="draft to published with publish" />
<parameter name="transition" value="published to unpublished with unpublish" />
<parameter name="transition" value="unpublished to published with publish" />
<parameter name="state_column" value="state" />
</behavior>
</table>
<table name="table_with_state_machine_behavior_with_custom_column">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<behavior name="state_machine">
<parameter name="states" value="draft, published, not_yEt_published, flagged" />
<parameter name="initial_state" value="draft" />
<parameter name="transition" value="draft to published with publish" />
<parameter name="transition" value="published to not_yet_published with unpublish" />
<parameter name="transition" value="not_yEt_published to published with publish" />
<parameter name="transition" value="not_yEt_published to flagged with flag_for_publish" />
<parameter name="transition" value="flagged to published with publish" />
<parameter name="state_column" value="my_state" />
</behavior>
</table>
</database>
EOF;
$builder = new QuickBuilder();
$config = $builder->getConfig();
$builder->setConfig($config);
$builder->setSchema($schema);
$builder->build();
}
}
示例2: testToArrayKeyTypePreDefined
public function testToArrayKeyTypePreDefined()
{
$schema = <<<EOF
<database name="test" namespace="MyNameSpace">
<table name="test_key_type_table">
<column name="id_key_type" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="name_key_type" type="VARCHAR" />
</table>
</database>
EOF;
$extraConf['propel']['generator']['objectModel']['defaultKeyType'] = 'camelName';
$generatorConfig = new QuickGeneratorConfig($extraConf);
$builder = new QuickBuilder();
$builder->setSchema($schema);
$builder->setConfig($generatorConfig);
$builder->buildClasses();
$expectedKeys = array('idKeyType', 'nameKeyType');
$object = new TestKeyTypeTable();
$this->assertEquals($expectedKeys, array_keys($object->toArray()), 'toArray() returns an associative array with pre-defined key type in properties.');
}