mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
MINOR Apply PSR-2 linting
This commit is contained in:
parent
3ee4ff4cb7
commit
0ad1fc367e
@ -158,7 +158,7 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sanitised = array();
|
$sanitised = array();
|
||||||
foreach($result as $class=>$title) {
|
foreach ($result as $class => $title) {
|
||||||
$sanitised[$this->sanitiseClassName($class)] = $title;
|
$sanitised[$this->sanitiseClassName($class)] = $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,11 +516,11 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
$sortTable = $this->getSortTable($list);
|
$sortTable = $this->getSortTable($list);
|
||||||
$additionalSQL = '';
|
$additionalSQL = '';
|
||||||
$baseTable = $sortTable;
|
$baseTable = $sortTable;
|
||||||
if(class_exists($sortTable)) {
|
if (class_exists($sortTable)) {
|
||||||
$baseTable = singleton($sortTable)->baseTable();
|
$baseTable = singleton($sortTable)->baseTable();
|
||||||
}
|
}
|
||||||
$isBaseTable = ($baseTable == $sortTable);
|
$isBaseTable = ($baseTable == $sortTable);
|
||||||
if(!$list instanceof ManyManyList && $isBaseTable){
|
if (!$list instanceof ManyManyList && $isBaseTable) {
|
||||||
$additionalSQL = ', "LastEdited" = NOW()';
|
$additionalSQL = ', "LastEdited" = NOW()';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +535,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
$this->getSortTableClauseForIds($list, $id)
|
$this->getSortTableClauseForIds($list, $id)
|
||||||
));
|
));
|
||||||
|
|
||||||
if(!$isBaseTable) {
|
if (!$isBaseTable) {
|
||||||
DB::query(sprintf(
|
DB::query(sprintf(
|
||||||
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
||||||
$baseTable,
|
$baseTable,
|
||||||
@ -570,11 +570,11 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
|
|
||||||
$additionalSQL = '';
|
$additionalSQL = '';
|
||||||
$baseTable = $table;
|
$baseTable = $table;
|
||||||
if(class_exists($table)) {
|
if (class_exists($table)) {
|
||||||
$baseTable = singleton($table)->baseTable();
|
$baseTable = singleton($table)->baseTable();
|
||||||
}
|
}
|
||||||
$isBaseTable = ($baseTable == $table);
|
$isBaseTable = ($baseTable == $table);
|
||||||
if(!$list instanceof ManyManyList && $isBaseTable){
|
if (!$list instanceof ManyManyList && $isBaseTable) {
|
||||||
$additionalSQL = ', "LastEdited" = NOW()';
|
$additionalSQL = ', "LastEdited" = NOW()';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
$this->getSortTableClauseForIds($list, $id)
|
$this->getSortTableClauseForIds($list, $id)
|
||||||
));
|
));
|
||||||
|
|
||||||
if(!$isBaseTable) {
|
if (!$isBaseTable) {
|
||||||
DB::query(sprintf(
|
DB::query(sprintf(
|
||||||
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
||||||
$baseTable,
|
$baseTable,
|
||||||
|
@ -13,9 +13,11 @@ use SilverStripe\Forms\GridField\GridFieldDetailForm;
|
|||||||
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
|
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
|
||||||
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClassHandler;
|
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClassHandler;
|
||||||
|
|
||||||
class GridFieldAddNewMultiClassWithNamespacesTest extends SapphireTest {
|
class GridFieldAddNewMultiClassWithNamespacesTest extends SapphireTest
|
||||||
|
{
|
||||||
|
|
||||||
public function testGetClassesWithNamespaces() {
|
public function testGetClassesWithNamespaces()
|
||||||
|
{
|
||||||
$grid = new GridField('TestGridField');
|
$grid = new GridField('TestGridField');
|
||||||
$grid->setModelClass('Symbiote\\Test\\NamespacedClass');
|
$grid->setModelClass('Symbiote\\Test\\NamespacedClass');
|
||||||
|
|
||||||
@ -30,7 +32,8 @@ class GridFieldAddNewMultiClassWithNamespacesTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHandleAddWithNamespaces() {
|
public function testHandleAddWithNamespaces()
|
||||||
|
{
|
||||||
$grid = new GridField('TestGridField');
|
$grid = new GridField('TestGridField');
|
||||||
$grid->getConfig()->addComponent(new GridFieldDetailForm());
|
$grid->getConfig()->addComponent(new GridFieldDetailForm());
|
||||||
$grid->setModelClass('Symbiote\\Test\\NamespacedClass');
|
$grid->setModelClass('Symbiote\\Test\\NamespacedClass');
|
||||||
@ -46,19 +49,21 @@ class GridFieldAddNewMultiClassWithNamespacesTest extends SapphireTest {
|
|||||||
$record->setAccessible(true);
|
$record->setAccessible(true);
|
||||||
$this->assertInstanceOf('Symbiote\\Test\\NamespacedClass', $record->getValue($response));
|
$this->assertInstanceOf('Symbiote\\Test\\NamespacedClass', $record->getValue($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**#@+
|
/**#@+
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NamespacedClass implements TestOnly {
|
class NamespacedClass implements TestOnly
|
||||||
public function i18n_singular_name() {
|
{
|
||||||
|
public function i18n_singular_name()
|
||||||
|
{
|
||||||
return 'NamespacedClass';
|
return 'NamespacedClass';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canCreate() {
|
public function canCreate()
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user