Merge pull request #2729 from halkyon/dataobject_validate_visibility

API DataObject::validate() visibility changed to public (issue #1659)
This commit is contained in:
Ingo Schommer 2013-12-19 09:16:34 -08:00
commit 145f7b13fa
4 changed files with 21 additions and 4 deletions

View File

@ -3,7 +3,24 @@
## Overview
* Minimum PHP version raised to 5.3.3
* DataObject::validate() method visibility changed to public
## Changelog
### Bugfixes
### 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

View File

@ -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;

View File

@ -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.

View File

@ -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 {