mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-08 09:08:50 +02:00
Merge pull request #2729 from halkyon/dataobject_validate_visibility
API DataObject::validate() visibility changed to public (issue #1659)
This commit is contained in:
commit
145f7b13fa
@ -3,7 +3,24 @@
|
||||
## Overview
|
||||
|
||||
* Minimum PHP version raised to 5.3.3
|
||||
* DataObject::validate() method visibility changed to public
|
||||
|
||||
## Changelog
|
||||
|
||||
### DataObject::validate() method visibility changed to public
|
||||
|
||||
The visibility of `DataObject::validate()` has been changed from `protected` to `public`.
|
||||
|
||||
Any existing classes that currently set this as `protected` should be changed like in
|
||||
this example:
|
||||
|
||||
::php
|
||||
class MyDataClass extends DataObject {
|
||||
...
|
||||
public function validate() {
|
||||
...
|
||||
}
|
||||
...
|
||||
}
|
||||
|
||||
### Bugfixes
|
@ -1015,7 +1015,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
*
|
||||
* @return A {@link ValidationResult} object
|
||||
*/
|
||||
protected function validate() {
|
||||
public function validate() {
|
||||
$result = ValidationResult::create();
|
||||
$this->extend('validate', $result);
|
||||
return $result;
|
||||
|
@ -14,7 +14,7 @@ class PermissionRoleCode extends DataObject {
|
||||
"Role" => "PermissionRole",
|
||||
);
|
||||
|
||||
protected function validate() {
|
||||
public function validate() {
|
||||
$result = parent::validate();
|
||||
|
||||
// Check that new code doesn't increase privileges, unless an admin is editing.
|
||||
|
@ -1304,7 +1304,7 @@ class DataObjectTest_ValidatedObject extends DataObject implements TestOnly {
|
||||
'Name' => 'Varchar(50)'
|
||||
);
|
||||
|
||||
protected function validate() {
|
||||
public function validate() {
|
||||
if(!empty($this->Name)) {
|
||||
return new ValidationResult();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user