FIX Rename JsonField to DMSJsonField to add a pseudo-namespace

This commit is contained in:
Robbie Averill 2017-05-24 14:29:51 +12:00
parent 2ddd20cd6c
commit 0ffd4d8584
3 changed files with 9 additions and 9 deletions

View File

@ -1,9 +1,9 @@
<?php
/**
* Class JsonField combines form inputs into a key-value pair
* Combines form inputs into a key-value pair
*/
class JsonField extends CompositeField
class DMSJsonField extends CompositeField
{
public function __construct($name, $children = null)
{
@ -90,7 +90,7 @@ class JsonField extends CompositeField
}
/**
* Sets
* Sets the value
* @param mixed $value
*
* @return $this

View File

@ -212,7 +212,7 @@ class DMSDocumentSet extends DataObject
$field->setMultiple(true)->setSource($map);
}
}
$keyValPairs = JsonField::create('KeyValuePairs', $dmsDocFields->toArray());
$keyValPairs = DMSJsonField::create('KeyValuePairs', $dmsDocFields->toArray());
// Now lastly add the sort fields
$sortedBy = FieldGroup::create('SortedBy', array(

View File

@ -1,22 +1,22 @@
<?php
class JsonFieldTest extends SapphireTest
class DMSJsonFieldTest extends SapphireTest
{
public function testJsonFieldConstructorMultiWays()
{
$jsonField = new JsonField('MyJsonField', new FieldList(
$jsonField = new DMSJsonField('MyJsonField', new FieldList(
new TextField('FirstName', 'Given name'),
new TextField('Surname', 'Last name')
));
$this->assertEquals($jsonField->FieldList()->count(), 2);
$this->assertNotNull($jsonField->FieldList()->dataFieldByName('MyJsonField[FirstName]'));
$jsonField = new JsonField('MyJsonField', array(new TextField('FirstName', 'Given name'),
$jsonField = new DMSJsonField('MyJsonField', array(new TextField('FirstName', 'Given name'),
new TextField('Surname', 'Last name')));
$this->assertEquals($jsonField->FieldList()->count(), 2);
$this->assertNotNull($jsonField->FieldList()->dataFieldByName('MyJsonField[FirstName]'));
$jsonField = new JsonField(
$jsonField = new DMSJsonField(
'MyJsonField',
new TextField('FirstName', 'Given name'),
new TextField('Surname', 'Last name')
@ -27,7 +27,7 @@ class JsonFieldTest extends SapphireTest
public function testJsonFieldDataValueCouldDealWithArray()
{
$jsonField = new JsonField('MyJsonField', new FieldList(
$jsonField = new DMSJsonField('MyJsonField', new FieldList(
new TextField('FirstName', 'Given name'),
new TextField('Surname', 'Last name')
));