本文整理汇总了PHP中PropelQuickBuilder::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP PropelQuickBuilder::getConfig方法的具体用法?PHP PropelQuickBuilder::getConfig怎么用?PHP PropelQuickBuilder::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropelQuickBuilder
的用法示例。
在下文中一共展示了PropelQuickBuilder::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
if (!class_exists('Post')) {
$schema = <<<EOF
<database name="lockable_behavior" defaultIdMethod="native">
<table name="post">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="title" type="varchar" size="255" />
<column name="description" type="longvarchar" />
<behavior name="lockable">
<parameter name="apply_to" value="title, description" />
<parameter name="with_description" value="true" />
</behavior>
</table>
</database>
EOF;
$builder = new PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behavior.visibility.class', '../src/LockableBehavior');
$builder->setConfig($config);
$builder->setSchema($schema);
$builder->build();
}
}
示例2: setUp
public function setUp()
{
$tables = array('Post' => <<<EOF
<database name="event_dispatcher_behavior" defaultIdMethod="native">
<table name="post">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="name" type="VARCHAR" required="true" />
<behavior name="event_dispatcher" />
</table>
</database>
EOF
, 'Thread' => <<<EOF
<database name="event_dispatcher_behavior2" defaultIdMethod="native">
<table name="thread">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="text" type="VARCHAR" required="true" />
<column name="allowed" type="boolean" required="true" defaultValue="false" />
<behavior name="event_dispatcher" />
</table>
</database>
EOF
);
foreach ($tables as $className => $schema) {
if (!class_exists($className)) {
$builder = new PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behavior.event_dispatcher.class', '../src/EventDispatcherBehavior');
$builder->setConfig($config);
$builder->setSchema($schema);
$builder->build();
}
}
}
示例3: getBuilder
protected function getBuilder($schema)
{
$builder = new PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behavior.equal_nest.class', '../src/EqualNestBehavior');
$builder->setConfig($config);
$builder->setSchema($schema);
return $builder;
}
示例4: setUp
public function setUp()
{
$this->schema = <<<EOF
<database name="bookstore" defaultIdMethod="native">
<table name="typehinted_object">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="name" type="VARCHAR" size="100" primaryString="true" />
<column name="roles" type="array" />
<behavior name="typehintable">
<parameter name="roles" value="array" />
</behavior>
</table>
<table name="typehinted_user">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true"/>
<column name="name" type="VARCHAR" size="32"/>
<column name="catched_exception" type="OBJECT" />
<column name="foo" type="OBJECT" />
<behavior name="typehintable">
<parameter name="typehinted_group" value="BaseTypehintedGroup" />
<parameter name="catched_exception" value="Exception" />
<parameter name="foo" value="TypehintedUser" />
<parameter name="nullable_columns" value="foo, catched_exception" />
</behavior>
</table>
<table name="typehinted_group">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true"/>
<column name="name" type="VARCHAR" size="32"/>
</table>
<table name="typehinted_user_group" isCrossRef="true">
<column name="user_id" type="INTEGER" primaryKey="true"/>
<column name="group_id" type="INTEGER" primaryKey="true"/>
<foreign-key foreignTable="typehinted_user">
<reference local="user_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="typehinted_group">
<reference local="group_id" foreign="id"/>
</foreign-key>
</table>
</database>
EOF;
if (!class_exists('TypehintedObject')) {
$builder = new PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behavior.typehintable.class', __DIR__ . '/../src/TypehintableBehavior');
$builder->setConfig($config);
$builder->setSchema($this->schema);
$builder->build();
}
}
示例5: simpleBuild
protected function simpleBuild($SchemaFile, $Namespace)
{
$XML = $this->LoadSchema($SchemaFile, $Namespace);
$builder = new \PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behaviorCacheableClass', 'RickySu\\CacheableBehaviorBundle\\Behavior\\CacheableBehavior');
$builder->setConfig($config);
$builder->setSchema($XML);
$builder->build();
}
示例6: loadAndBuild
protected function loadAndBuild()
{
$this->loadPropelQuickBuilder();
if (!class_exists('Glorpen\\Propel\\PropelBundle\\Tests\\Fixtures\\Model\\Book', false)) {
$builder = new \PropelQuickBuilder();
$builder->getConfig()->setBuildProperty('behaviorEventClass', 'Behaviors.EventBehavior');
$builder->getConfig()->setBuildProperty('behaviorExtendClass', 'Behaviors.ExtendBehavior');
$builder->setSchema(static::$schema);
$builder->setClassTargets(array('tablemap', 'peer', 'object', 'query', 'peerstub', 'querystub'));
file_put_contents("/tmp/a.php", $builder->getClasses());
$builder->build();
$con = new EventPropelPDO('sqlite::memory:');
$con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
$name = $builder->getDatabase()->getName();
\Propel::setConnection($name, $con, \Propel::CONNECTION_READ);
\Propel::setConnection($name, $con, \Propel::CONNECTION_WRITE);
$builder->buildSQL($con);
}
}
示例7: setUp
protected function setUp()
{
//begin of setting runtime environments
$fileSystem = vfsStream::setup();
$this->className = 'ExampleInstantiator';
$this->extends = '\\stdClass';
$this->indention = ' ';
$this->namespace = 'Test\\Net\\Bazzline\\Propel';
$this->path = $fileSystem->url();
$this->prefix = 'create';
//end of setting runtime environments
$buildIsNeeded = !class_exists('TableOne') || !class_exists('TableTwo');
if ($buildIsNeeded) {
$schema = <<<EOF
<database name="example_database" defaultIdMethod="native">
<behavior name="add_to_entity_instantiator">
<parameter name="entity_instantiator_class_name" value="{$this->className}" />
<parameter name="entity_instantiator_extends" value="{$this->extends}" />
<parameter name="entity_instantiator_indention" value="{$this->indention}" />
<parameter name="entity_instantiator_namespace" value="{$this->namespace}" />
<parameter name="entity_instantiator_path_to_output" value="{$this->path}" />
<parameter name="entity_method_name_prefix" value="{$this->prefix}" />
<parameter name="entity_add_to_entity_instantiator" value="true" />
</behavior>
<table name="table_one">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
</table>
<table name="table_two">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<behavior name="add_to_entity_instantiator">
<parameter name="entity_add_to_entity_instantiator" value="false" />
</behavior>
</table>
</database>
EOF;
$builder = new PropelQuickBuilder();
$configuration = $builder->getConfig();
$configuration->setBuildProperty('behavior.add_to_entity_instantiator.class', __DIR__ . '/../source/AddToEntityInstantiatorBehavior');
$builder->setConfig($configuration);
$builder->setSchema($schema);
$builder->build();
//we have to call generate manually since it is called only when php execution is finished
Manager::getInstance()->generate();
}
}
开发者ID:bazzline,项目名称:php_propel_behavior_entity_instantiator,代码行数:48,代码来源:AddToEntityInstantiatorBehaviorTest.php
示例8: setUp
public function setUp()
{
if (!class_exists('DateTimeColumnTypeEntity')) {
$schema = <<<EOF
<database name="generated_object_datetime_type_test">
<table name="date_time_column_type_entity" idMethod="native">
<column name="id" primaryKey="true" type="INTEGER" phpName="Id" required="true"/>
<column name="primary_date" primaryKey="true" type="DATE" phpName="PrimaryDate" required="true"/>
</table>
</database>
EOF;
$builder = new PropelQuickBuilder();
$builder->getConfig()->setBuildProperty('defaultDateFormat', null);
$builder->setSchema($schema);
$builder->build();
}
}
示例9: setUp
public function setUp()
{
if (!class_exists('Post')) {
$schema = <<<EOF
<database name="create_entity_behavior" defaultIdMethod="native">
<table name="Post">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<behavior name="create_entity" />
</table>
</database>
EOF;
$builder = new PropelQuickBuilder();
$configuration = $builder->getConfig();
$configuration->setBuildProperty('behavior.create_entity.class', '../source/CreateEntityBehavior');
$builder->setConfig($configuration);
$builder->setSchema($schema);
$builder->build();
}
}
示例10: setUp
public function setUp()
{
if (!class_exists('TestModel')) {
$schema = <<<EOF
<database name="TestDatabase" defaultIdMethod="native">
<table name="TestModel">
<column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
<column name="email_address" phpName="EmailAddress" type="VARCHAR" size="100" required="true" />
<behavior name="auditable" />
</table>
</database>
EOF;
$builder = new PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behavior.auditable.class', __DIR__ . '/../src/AuditableBehavior');
$builder->setConfig($config);
$builder->setSchema($schema);
$this->con = $builder->build();
}
}
示例11: setUp
public function setUp()
{
if (!class_exists('Author')) {
$schema = <<<EOF
<database name="bookstore" defaultIdMethod="native">
<table name="author">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="first_name" type="VARCHAR" size="255" />
<column name="last_name" type="VARCHAR" size="255" />
<behavior name="providerBase" />
</table>
</database>
EOF;
$builder = new PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behavior.provider_base.class', __DIR__ . '/../src/ProviderBaseBehavior/ProviderBaseBehavior');
$builder->setConfig($config);
$builder->setSchema($schema);
$con = $builder->build();
}
}
示例12: setUp
public function setUp()
{
if (!class_exists('My\\Post')) {
$schema = <<<EOF
<database name="event_dispatcher_behavior" defaultIdMethod="native" namespace="My">
<table name="post">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="name" type="VARCHAR" required="true" />
<behavior name="event_dispatcher" />
</table>
</database>
EOF;
$builder = new PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behavior.event_dispatcher.class', '../src/EventDispatcherBehavior');
$builder->setConfig($config);
$builder->setSchema($schema);
$builder->build();
}
}
开发者ID:GoldenLine,项目名称:EventDispatcherBehavior,代码行数:21,代码来源:EventDispatcherBehaviorWithNamespacesTest.php
示例13: setUp
public function setUp()
{
if (!class_exists('Foo')) {
$schema = <<<EOF
<database name="hstore_behavior" defaultIdMethod="native">
<table name="foo">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="name" type="VARCHAR" required="true" />
<column name="property" type="VARCHAR" required="true" />
<behavior name="postgres_hstore">
<parameter name="column_name" value="property" />
</behavior>
</table>
</database>
EOF;
$builder = new PropelQuickBuilder();
$config = $builder->getConfig();
$config->setBuildProperty('behavior.postgres_hstore.class', '../src/PostgresHstoreBehavior');
$builder->setConfig($config);
$builder->setSchema($schema);
$builder->build();
}
}
示例14: exit
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
if (!($loader = @(include __DIR__ . '/../vendor/autoload.php'))) {
echo <<<EOT
You need to install the project dependencies using Composer:
\$ wget http://getcomposer.org/composer.phar
OR
\$ curl -s https://getcomposer.org/installer | php
\$ php composer.phar install --dev
\$ phpunit
EOT;
exit(1);
}
if (class_exists('Propel')) {
set_include_path(__DIR__ . '/../vendor/phing/phing/classes' . PATH_SEPARATOR . get_include_path());
$class = new \ReflectionClass('TypehintableBehavior');
$builder = new \PropelQuickBuilder();
$builder->getConfig()->setBuildProperty('behavior.typehintable.class', $class->getFileName());
$builder->setSchema(file_get_contents(__DIR__ . '/../Resources/config/propel/schema.xml'));
$builder->setClassTargets(array('tablemap', 'peer', 'object', 'query'));
$builder->build();
}
示例15: testToArrayKeyTypePreDefined
public function testToArrayKeyTypePreDefined()
{
$schema = <<<EOF
<database name="test">
<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;
$builder = new PropelQuickBuilder();
$builder->setSchema($schema);
$builder->getConfig()->setBuildProperty('defaultKeyType', 'studlyPhpName');
$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.');
}