Skip to content

Commit

Permalink
ENH Use class name instead of self
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jun 5, 2024
1 parent bad865d commit 1f1bdad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Forms/GridField/GridFieldAddByDBField.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,6 @@ public function getHTMLFragments($gridField)
$forTemplate->Fields->push($textField);
$forTemplate->Fields->push($addAction);

return [$this->targetFragment => $forTemplate->renderWith(self::class)];
return [$this->targetFragment => $forTemplate->renderWith(GridFieldAddByDBField::class)];
}
}
6 changes: 3 additions & 3 deletions src/Model/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public function canEditEditors($member = null)
return $extended;
}

return Permission::checkMember($member, self::MANAGE_USERS);
return Permission::checkMember($member, Blog::MANAGE_USERS);
}

/**
Expand All @@ -499,7 +499,7 @@ public function canEditWriters($member = null)
return true;
}

return Permission::checkMember($member, self::MANAGE_USERS);
return Permission::checkMember($member, Blog::MANAGE_USERS);
}

/**
Expand All @@ -523,7 +523,7 @@ public function canEditContributors($member = null)
return true;
}

return Permission::checkMember($member, self::MANAGE_USERS);
return Permission::checkMember($member, Blog::MANAGE_USERS);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Model/BlogObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function validate()
}

if ($this->getDuplicatesByField('Title')->count() > 0) {
$validation->addError($this->getDuplicateError(), self::DUPLICATE_EXCEPTION);
$validation->addError($this->getDuplicateError(), BlogObject::DUPLICATE_EXCEPTION);
}

return $validation;
Expand Down Expand Up @@ -204,7 +204,7 @@ public function generateURLSegment($increment = 0)
*/
protected function getDuplicatesByField($field)
{
$duplicates = DataList::create(self::class)
$duplicates = DataList::create(BlogObject::class)
->filter(
[
$field => $this->$field,
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Widgets/BlogArchiveWidgetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BlogArchiveWidgetTest extends SapphireTest
protected function setUp(): void
{
if (!class_exists(Widget::class)) {
self::$fixture_file = null;
BlogArchiveWidgetTest::$fixture_file = null;
parent::setUp();
$this->markTestSkipped('Test requires silverstripe/widgets to be installed.');
}
Expand Down

0 comments on commit 1f1bdad

Please sign in to comment.