FIX Namespacing errors and method incompatibilities with parent classes

This commit is contained in:
Robbie Averill 2017-08-11 12:36:28 +12:00
parent b8d6ac336f
commit cd314d3a3c
21 changed files with 29 additions and 27 deletions

View File

@ -15,7 +15,7 @@ use SilverStripe\ORM\DataExtension;
use SilverStripe\UserForms\Form\GridFieldAddClassesButton;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
use SilverStripe\Versioned\Versioned;

View File

@ -5,7 +5,7 @@ namespace SilverStripe\UserForms\Extension;
use SilverStripe\Forms\RequiredFields;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
class UserFormValidator extends RequiredFields

View File

@ -3,7 +3,7 @@
namespace SilverStripe\UserForms\FormField;
use SilverStripe\Forms\CompositeField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
/**

View File

@ -2,7 +2,7 @@
namespace SilverStripe\UserForms\FormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
/**
* Represents a field container which can iteratively process nested fields, converting it into a fieldset

View File

@ -3,7 +3,7 @@
namespace SilverStripe\UserForms\FormField;
use SilverStripe\Forms\FieldList;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
/**
* A list of formfields which allows for iterative processing of nested composite fields

View File

@ -3,7 +3,7 @@
namespace SilverStripe\UserForms\FormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
/**
* Front end composite field for userforms

View File

@ -7,7 +7,7 @@ use SilverStripe\CMS\Controllers\CMSMain;
use SilverStripe\Control\Controller;
use SilverStripe\Core\Convert;
use SilverStripe\ORM\DataObject;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
use Silverstripe\Versioned\Versioned;
/**
@ -112,7 +112,7 @@ class EditableCustomRule extends DataObject
* @param array $context Virtual parameter to allow context to be passed in to check
* @return bool
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
// Check parent page
$parent = $this->getCanCreateContext(func_get_args());

View File

@ -1,6 +1,6 @@
<?php
namespace SilverStripe\UserForms\Model\EditableFormField;
namespace SilverStripe\UserForms\Model;
use SilverStripe\CMS\Controllers\CMSMain;
use SilverStripe\CMS\Controllers\CMSPageEditController;
@ -32,7 +32,6 @@ use SilverStripe\UserForms\Model\UserDefinedForm;
use SilverStripe\UserForms\Model\EditableCustomRule;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
use SilverStripe\UserForms\Model\Submission\SubmittedFormField;
use SilverStripe\UserForms\Modifier\DisambiguationSegmentFieldModifier;
@ -505,7 +504,7 @@ class EditableFormField extends DataObject
* @param array $context Virtual parameter to allow context to be passed in to check
* @return bool
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
// Check parent page
$parent = $this->getCanCreateContext(func_get_args());

View File

@ -4,6 +4,7 @@ namespace SilverStripe\UserForms\Model\EditableFormField;
use CountryDropdownField; // @todo
use SilverStripe\UserForms\Model\EditableCustomRule;
use SilverStripe\UserForms\Model\EditableFormField;
/**
* A dropdown field which allows the user to select a country

View File

@ -5,6 +5,7 @@ namespace SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\Core\Convert;
use SilverStripe\Forms\LabelField;
use SilverStripe\UserForms\FormField\UserFormsGroupField;
use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
/**

View File

@ -194,7 +194,7 @@ class EditableMultipleOptionField extends EditableFormField
*
* @return DataObject
*/
public function duplicate($doWrite = true)
public function duplicate($doWrite = true, $manyMany = 'many_many')
{
$clonedNode = parent::duplicate();

View File

@ -110,7 +110,7 @@ class EditableOption extends DataObject
* @param array $context Virtual parameter to allow context to be passed in to check
* @return bool
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
// Check parent page
$parent = $this->getCanCreateContext(func_get_args());

View File

@ -26,7 +26,7 @@ use SilverStripe\Forms\TextField;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject;
use SilverStripe\UserForms\Model\EditableFormField\EditableEmailField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableMultipleOptionField;
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
use SilverStripe\UserForms\Model\Recipient\EmailRecipientCondition;
@ -376,7 +376,7 @@ class EmailRecipient extends DataObject
* @param array $context Virtual parameter to allow context to be passed in to check
* @return bool
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
// Check parent page
$parent = $this->getCanCreateContext(func_get_args());

View File

@ -7,7 +7,7 @@ use SilverStripe\CMS\Controllers\CMSMain;
use SilverStripe\Control\Controller;
use SilverStripe\ORM\DataObject;
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
/**
* Declares a condition that determines whether an email can be sent to a given recipient
@ -109,7 +109,7 @@ class EmailRecipientCondition extends DataObject
* @param array $context Virtual parameter to allow context to be passed in to check
* @return bool
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
// Check parent page
$parent = $this->getCanCreateContext(func_get_args());

View File

@ -26,10 +26,13 @@ class UserFormRecipientEmail extends Email
* Set the "Reply-To" header with an email address rather than append as
* {@link Email::replyTo} does.
*
* @param string $email The email address to set the "Reply-To" header to
* @param string|array $address
* @param string|null $name
* @return $this
*/
public function setReplyTo($email)
public function setReplyTo($address, $name = null)
{
$this->customHeaders['Reply-To'] = $email;
return $this;
}
}

View File

@ -117,7 +117,7 @@ class SubmittedForm extends DataObject
*
* @return boolean
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
$extended = $this->extendedCan(__FUNCTION__, $member);
if ($extended !== null) {

View File

@ -34,7 +34,7 @@ class SubmittedFormField extends DataObject
*
* @return boolean
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
return $this->Parent()->canCreate();
}

View File

@ -5,7 +5,6 @@ namespace SilverStripe\UserForms\Model;
use Page;
use Colymba\BulkManager\BulkManager;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\FieldList;
@ -33,7 +32,6 @@ use SilverStripe\ORM\DB;
use SilverStripe\UserForms\Extension\UserFormFieldEditorExtension;
use SilverStripe\UserForms\Extension\UserFormValidator;
use SilverStripe\UserForms\Form\UserFormsGridFieldFilterHeader;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
use SilverStripe\UserForms\Model\Recipient\UserFormRecipientItemRequest;
use SilverStripe\UserForms\Model\Submission\SubmittedForm;

View File

@ -5,7 +5,7 @@ namespace SilverStripe\UserForms\Task;
use SilverStripe\Dev\MigrationTask;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
/**
* UserForms Column Clean Task

View File

@ -10,7 +10,7 @@ use SilverStripe\Security\Member;
use SilverStripe\UserForms\Model\EditableFormField\EditableCheckbox;
use SilverStripe\UserForms\Model\EditableFormField\EditableDropdown;
use SilverStripe\UserForms\Model\EditableFormField\EditableFileField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableOption;
use SilverStripe\UserForms\Model\EditableFormField\EditableRadioField;
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;

View File

@ -16,7 +16,7 @@ use SilverStripe\UserForms\Extension\UserFormValidator;
use SilverStripe\UserForms\Model\EditableCustomRule;
use SilverStripe\UserForms\Model\EditableFormField\EditableEmailField;
use SilverStripe\UserForms\Model\EditableFormField\EditableDropdown;
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
@ -50,7 +50,7 @@ class UserDefinedFormTest extends FunctionalTest
$form->doPublish();
// check published site
$updated = Versioned::get_one_by_stage(UserDefinedForm::class, 'Stage', \"UserDefinedForm\".\"ID\" = $form->ID");
$updated = Versioned::get_one_by_stage(UserDefinedForm::class, 'Stage', "\"UserDefinedForm\".\"ID\" = $form->ID");
$this->assertEquals($updated->SubmitButtonText, 'Updated Button Text');
$form->doRollbackTo($origVersion);