mirror of
https://github.com/silverstripe/silverstripe-restfulserver
synced 2024-10-22 14:05:58 +02:00
Merge pull request #49 from creative-commoners/pulls/2.0/fix-relation-getter
FIX getFieldsForObj does not return relation classes in hasField() check
This commit is contained in:
commit
b59d956143
@ -301,7 +301,9 @@ abstract class DataFormatter
|
|||||||
if (is_array($this->customFields)) {
|
if (is_array($this->customFields)) {
|
||||||
foreach ($this->customFields as $fieldName) {
|
foreach ($this->customFields as $fieldName) {
|
||||||
// @todo Possible security risk by making methods accessible - implement field-level security
|
// @todo Possible security risk by making methods accessible - implement field-level security
|
||||||
if ($obj->hasField($fieldName) || $obj->hasMethod("get{$fieldName}")) {
|
if (($obj->hasField($fieldName) && !is_object($obj->getField($fieldName)))
|
||||||
|
|| $obj->hasMethod("get{$fieldName}")
|
||||||
|
) {
|
||||||
$dbFields[$fieldName] = $fieldName;
|
$dbFields[$fieldName] = $fieldName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,8 @@
|
|||||||
|
|
||||||
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
||||||
|
|
||||||
use SilverStripe\RestfulServer\Tests\Stubs\RestfulServerTestPage;
|
|
||||||
use SilverStripe\RestfulServer\Tests\Stubs\RestfulServerTestAuthor;
|
|
||||||
use SilverStripe\RestfulServer\Tests\Stubs\RestfulServerTestAuthorRating;
|
|
||||||
use SilverStripe\ORM\DataObject;
|
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
class RestfulServerTestAuthor extends DataObject implements TestOnly
|
class RestfulServerTestAuthor extends DataObject implements TestOnly
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
||||||
|
|
||||||
use SilverStripe\RestfulServer\Tests\Stubs\RestfulServerTestAuthor;
|
|
||||||
use SilverStripe\ORM\DataObject;
|
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
class RestfulServerTestAuthorRating extends DataObject implements TestOnly
|
class RestfulServerTestAuthorRating extends DataObject implements TestOnly
|
||||||
{
|
{
|
||||||
|
@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
||||||
|
|
||||||
use SilverStripe\RestfulServer\Tests\Stubs\RestfulServerTestPage;
|
|
||||||
use SilverStripe\RestfulServer\Tests\Stubs\RestfulServerTestAuthor;
|
|
||||||
use SilverStripe\Security\Permission;
|
|
||||||
use SilverStripe\ORM\DataObject;
|
|
||||||
use SilverStripe\Security\PermissionProvider;
|
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\Security\Permission;
|
||||||
|
use SilverStripe\Security\PermissionProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Everybody can view comments, logged in members in the "users" group can create comments,
|
* Everybody can view comments, logged in members in the "users" group can create comments,
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
||||||
|
|
||||||
use SilverStripe\RestfulServer\Tests\Stubs\RestfulServerTestAuthor;
|
|
||||||
use SilverStripe\RestfulServer\Tests\Stubs\RestfulServerTestComment;
|
|
||||||
use SilverStripe\ORM\DataObject;
|
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
class RestfulServerTestPage extends DataObject implements TestOnly
|
class RestfulServerTestPage extends DataObject implements TestOnly
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
namespace SilverStripe\RestfulServer\Tests\Stubs;
|
||||||
|
|
||||||
use SilverStripe\Security\Permission;
|
|
||||||
use SilverStripe\ORM\DataObject;
|
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\Security\Permission;
|
||||||
use SilverStripe\Security\PermissionProvider;
|
use SilverStripe\Security\PermissionProvider;
|
||||||
|
|
||||||
class RestfulServerTestSecretThing extends DataObject implements TestOnly, PermissionProvider
|
class RestfulServerTestSecretThing extends DataObject implements TestOnly, PermissionProvider
|
||||||
|
Loading…
Reference in New Issue
Block a user