mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-08 18:51:12 +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
|
## Overview
|
||||||
|
|
||||||
* Minimum PHP version raised to 5.3.3
|
* Minimum PHP version raised to 5.3.3
|
||||||
|
* DataObject::validate() method visibility changed to public
|
||||||
|
|
||||||
## Changelog
|
## 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
|
### Bugfixes
|
@ -1015,7 +1015,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
*
|
*
|
||||||
* @return A {@link ValidationResult} object
|
* @return A {@link ValidationResult} object
|
||||||
*/
|
*/
|
||||||
protected function validate() {
|
public function validate() {
|
||||||
$result = ValidationResult::create();
|
$result = ValidationResult::create();
|
||||||
$this->extend('validate', $result);
|
$this->extend('validate', $result);
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -14,7 +14,7 @@ class PermissionRoleCode extends DataObject {
|
|||||||
"Role" => "PermissionRole",
|
"Role" => "PermissionRole",
|
||||||
);
|
);
|
||||||
|
|
||||||
protected function validate() {
|
public function validate() {
|
||||||
$result = parent::validate();
|
$result = parent::validate();
|
||||||
|
|
||||||
// Check that new code doesn't increase privileges, unless an admin is editing.
|
// 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)'
|
'Name' => 'Varchar(50)'
|
||||||
);
|
);
|
||||||
|
|
||||||
protected function validate() {
|
public function validate() {
|
||||||
if(!empty($this->Name)) {
|
if(!empty($this->Name)) {
|
||||||
return new ValidationResult();
|
return new ValidationResult();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user