mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge branch '3'
This commit is contained in:
commit
f225b83e2b
@ -22,7 +22,7 @@
|
||||
<ul class="cms-tabset-nav-primary">
|
||||
<% loop $ManagedModelTabs %>
|
||||
<li class="tab-$ClassName $LinkOrCurrent<% if $LinkOrCurrent == 'current' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$Link" class="cms-panel-link" title="Form_EditForm">$Title</a>
|
||||
<a href="$Link" class="cms-panel-link" title="$Title.ATT">$Title</a>
|
||||
</li>
|
||||
<% end_loop %>
|
||||
</ul>
|
||||
|
@ -360,10 +360,12 @@ class SQLSelect extends SQLConditionalExpression
|
||||
if (strpos($clause, '(') !== false || strpos($clause, " ") !== false) {
|
||||
// Move the clause to the select fragment, substituting a placeholder column in the sort fragment.
|
||||
$clause = trim($clause);
|
||||
do {
|
||||
$column = "_SortColumn{$i}";
|
||||
++$i;
|
||||
} while (array_key_exists('"' . $column . '"', $this->orderby));
|
||||
$this->selectField($clause, $column);
|
||||
$clause = '"' . $column . '"';
|
||||
$i++;
|
||||
}
|
||||
$orderby[$clause] = $dir;
|
||||
}
|
||||
|
@ -141,6 +141,19 @@ class SQLSelectTest extends SapphireTest
|
||||
$this->assertTrue($query->canSortBy('Name'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test multiple order by SQL clauses.
|
||||
*/
|
||||
public function testAddOrderBy()
|
||||
{
|
||||
$query = new SQLSelect();
|
||||
$query->setSelect('ID', "Title")->setFrom('Page')->addOrderBy('(ID % 2) = 0', 'ASC')->addOrderBy('ID > 50', 'ASC');
|
||||
$this->assertSQLEquals(
|
||||
'SELECT ID, Title, (ID % 2) = 0 AS "_SortColumn0", ID > 50 AS "_SortColumn1" FROM Page ORDER BY "_SortColumn0" ASC, "_SortColumn1" ASC',
|
||||
$query->sql($parameters)
|
||||
);
|
||||
}
|
||||
|
||||
public function testSelectWithChainedFilterParameters()
|
||||
{
|
||||
$query = new SQLSelect();
|
||||
|
Loading…
x
Reference in New Issue
Block a user