本文整理匯總了PHP中ModelCriteria::getJoin方法的典型用法代碼示例。如果您正苦於以下問題:PHP ModelCriteria::getJoin方法的具體用法?PHP ModelCriteria::getJoin怎麽用?PHP ModelCriteria::getJoin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ModelCriteria
的用法示例。
在下文中一共展示了ModelCriteria::getJoin方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addQueryColumns
protected function addQueryColumns()
{
$tableMap = $this->query->getTableMap();
foreach ($tableMap->getColumns() as $column) {
if ($column->isForeignKey()) {
continue;
}
$name = strtolower($column->getName());
$this->addColumn($name, array('hide' => $column->isPrimaryKey(), 'phpName' => $column->getPhpName(), 'action' => $column->isPrimaryString() ? 'edit' : null));
}
// add virtual columns
foreach ($this->query->getAsColumns() as $colName => $clause) {
$this->addColumn($colName, array('phpName' => $colName));
}
$behaviors = $tableMap->getBehaviors();
if (array_key_exists('sortable', $behaviors)) {
$rankCol = strtolower($behaviors['sortable']['rank_column']);
if (isset($this->columns[$rankCol])) {
$this->addColumn($rankCol, array('hide' => true));
$this->setOptions(array('defaultSortColumn' => $rankCol));
}
$this->setOptions(array('sortable' => array($this, 'sortItems')));
}
$i18nTableName = $this->getI18nTableName($tableMap);
if ($i18nTableName !== null && $this->query->getJoin($i18nTableName) !== null) {
$i18nTableMap = \PropelQuery::from($i18nTableName)->getTableMap();
foreach ($i18nTableMap->getColumns() as $column) {
if ($column->isPrimaryKey()) {
continue;
}
$this->addColumn(strtolower($column->getName()), array('sortCallback' => array($this, 'sortI18nColumn'), 'phpName' => $column->getPhpName()));
}
}
}
示例2: testGetJoin
public function testGetJoin()
{
$c = new ModelCriteria('bookstore', 'Book');
$c->join('Book.Author');
$joins = $c->getJoins();
$this->assertEquals($joins['Author'], $c->getJoin('Author'), "getJoin() returns a specific Join from the ModelCriteria");
}