本文整理汇总了PHP中Propel::getconnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Propel::getconnection方法的具体用法?PHP Propel::getconnection怎么用?PHP Propel::getconnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel
的用法示例。
在下文中一共展示了Propel::getconnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLazyLoadedColumnsWithDefaultRequireAnAdditionalQueryOnGetter
public function testLazyLoadedColumnsWithDefaultRequireAnAdditionalQueryOnGetter()
{
$con = Propel::getconnection(LazyLoadActiveRecordPeer::DATABASE_NAME);
$con->useDebug(true);
$obj = new LazyLoadActiveRecord();
$obj->setBaz('hello');
$obj->save($con);
LazyLoadActiveRecordPeer::clearInstancePool();
$obj2 = LazyLoadActiveRecordQuery::create()->findPk($obj->getId(), $con);
$count = $con->getQueryCount();
$this->assertEquals('hello', $obj2->getBaz($con));
$this->assertEquals($count + 1, $con->getQueryCount());
}
示例2: testLazyLoadedColumnsMayBeUnsetWithoutLoading
public function testLazyLoadedColumnsMayBeUnsetWithoutLoading()
{
$con = Propel::getconnection(LazyLoadActiveRecordPeer::DATABASE_NAME);
$con->useDebug(true);
$obj = new LazyLoadActiveRecord();
$obj->setBar('hello');
$obj->save($con);
LazyLoadActiveRecordPeer::clearInstancePool();
$obj2 = LazyLoadActiveRecordQuery::create()->findPk($obj->getId(), $con);
$obj2->setBar(null);
$obj2->save();
LazyLoadActiveRecordPeer::clearInstancePool();
$obj3 = LazyLoadActiveRecordQuery::create()->findPk($obj->getId(), $con);
$this->assertNull($obj3->getBar());
}