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())); } } }
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"); }