Skip to content

Commit

Permalink
Merge pull request dynamic#86 from jsirish/enhancement/psr2
Browse files Browse the repository at this point in the history
PSR2-2 formatting
  • Loading branch information
jsirish committed Apr 8, 2016
2 parents 29ed756 + c8906cb commit a649028
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions code/LocationCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class LocationCategory extends DataObject
);

private static $belogs_many_many = array(
'Locators' => 'Locator'
'Locators' => 'Locator',
);

private static $singular_name = "Category";
Private static $plural_name = "Categories";
private static $singular_name = 'Category';
private static $plural_name = 'Categories';

private static $default_sort = 'Name';
}
4 changes: 3 additions & 1 deletion code/Locator.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ public function getAllCategories()
public static function getPageCategories($id = null)
{
if ($id) {
if ($locator = Locator::get()->byID($id)) {
if ($locator = self::get()->byID($id)) {
return $locator->Categories();
}

return false;
}

return false;
}
}
Expand Down
3 changes: 1 addition & 2 deletions tests/LocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testLocationSearch()
$object = Locator_Controller::create($locator);
$form = $object->LocationSearch();
$this->assertTrue(is_a($form, 'Form'));

$category = $this->objFromFixture('LocationCategory', 'service');
$category2 = $this->objFromFixture('LocationCategory', 'manufacturing');
$locator->Categories()->add($category);
Expand All @@ -65,6 +65,5 @@ public function testLocationSearch()
$form = $object->LocationSearch();
$fields = $form->Fields();
$this->assertNotNull($fields->fieldByName('category'));

}
}

0 comments on commit a649028

Please sign in to comment.