本文整理汇总了PHP中ModelCriteria::explain方法的典型用法代码示例。如果您正苦于以下问题:PHP ModelCriteria::explain方法的具体用法?PHP ModelCriteria::explain怎么用?PHP ModelCriteria::explain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelCriteria
的用法示例。
在下文中一共展示了ModelCriteria::explain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExplainPlanFromObject
public function testExplainPlanFromObject()
{
BookstoreDataPopulator::depopulate($this->con);
BookstoreDataPopulator::populate($this->con);
$db = Propel::getDb(BookPeer::DATABASE_NAME);
$c = new ModelCriteria('bookstore', 'Book');
$c->join('Book.Author');
$c->where('Author.FirstName = ?', 'Neal');
$c->select('Title');
$explain = $c->explain($this->con);
if ($db instanceof DBMySQL) {
$this->assertEquals(sizeof($explain), 2, 'Explain plan return two lines');
// explain can change sometime, test can't be strict
$this->assertArrayHasKey('select_type', $explain[0], 'Line 1, select_type key exist');
$this->assertArrayHasKey('table', $explain[0], 'Line 1, table key exist');
$this->assertArrayHasKey('type', $explain[0], 'Line 1, type key exist');
$this->assertArrayHasKey('possible_keys', $explain[0], 'Line 1, possible_keys key exist');
$this->assertArrayHasKey('select_type', $explain[1], 'Line 2, select_type key exist');
$this->assertArrayHasKey('table', $explain[1], 'Line 2, table key exist');
$this->assertArrayHasKey('type', $explain[1], 'Line 2, type key exist');
$this->assertArrayHasKey('possible_keys', $explain[1], 'Line 2, possible_keys key exist');
} elseif ($db instanceof DBOracle) {
$this->assertTrue(sizeof($explain) > 2, 'Explain plan return more than 2 lines');
} else {
$this->markTestSkipped('Cannot test explain plan on adapter ' . get_class($db));
}
}