Completed
Pull Request — master (#12)
by Matthew
20:58 queued 05:58
created
src/Extensions/ManageableDataObjectExtension.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
         }
53 53
 
54 54
         return Security::permissionFailure(
55
-        	$this->owner,
56
-			"You don't have permission to add records."
57
-		);
55
+            $this->owner,
56
+            "You don't have permission to add records."
57
+        );
58 58
     }
59 59
 
60 60
     /**
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
             }
79 79
 
80 80
             return Security::permissionFailure(
81
-            	$this->owner,
82
-				"You don't have permission to edit this record."
83
-			);
81
+                $this->owner,
82
+                "You don't have permission to edit this record."
83
+            );
84 84
         }
85 85
 
86 86
         return $this->owner->httpError(404);
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
             }
106 106
 
107 107
             return Security::permissionFailure(
108
-            	$this->owner,
109
-				"You don't have permission to delete this record."
110
-			);
108
+                $this->owner,
109
+                "You don't have permission to delete this record."
110
+            );
111 111
         }
112 112
 
113 113
         return $this->owner->httpError(404);
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
         return $form;
145 145
     }
146 146
 
147
-	/**
148
-	 * Save object
149
-	 *
150
-	 * @param $data
151
-	 * @param Form $form
152
-	 *
153
-	 * @return \SilverStripe\Control\HTTPResponse
154
-	 * @throws \SilverStripe\ORM\ValidationException
155
-	 */
147
+    /**
148
+     * Save object
149
+     *
150
+     * @param $data
151
+     * @param Form $form
152
+     *
153
+     * @return \SilverStripe\Control\HTTPResponse
154
+     * @throws \SilverStripe\ORM\ValidationException
155
+     */
156 156
     public function doSaveObject($data, Form $form)
157 157
     {
158
-		/** @var \SilverStripe\ORM\DataObject $model */
158
+        /** @var \SilverStripe\ORM\DataObject $model */
159 159
         $model = $this->owner->config()->get('managed_object');
160 160
 
161 161
         /** @var \SilverStripe\ORM\DataObject|\Dynamic\ViewableDataObject\Extensions\ViewableDataObject $object */
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             $object = $model::create();
169 169
             if ($object->hasDatabaseField('URLSegment')) {
170 170
                 $object->URLSegment = Injector::inst()->create(SiteTree::class)
171
-					->generateURLSegment($data['Title']);
171
+                    ->generateURLSegment($data['Title']);
172 172
             }
173 173
             // write on create to relations are saved on final write (needs ID)
174 174
             $object->write();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
         if ($object->canCreate(Security::getCurrentUser())) {
40 40
 
41 41
             $form = $this->ManageableDataObjectForm();
42
-            if($object->config()->get('add_form_cancel_button')){
42
+            if ($object->config()->get('add_form_cancel_button')) {
43 43
                 $form->Actions()->push(new CancelFormAction($this->owner->Link(), 'Cancel'));
44 44
             }
45 45
 
46 46
             return $this->owner->customise([
47 47
                 'Title' => ($this->owner->config()->get('add_item_title'))
48 48
                     ? $this->owner->config()->get('add_item_title')
49
-                    : 'Add new ' . $object->singular_name(),
49
+                    : 'Add new '.$object->singular_name(),
50 50
                 'ManageableDataObjectForm' => $form,
51 51
             ]);
52 52
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 $form = $this->ManageableDataObjectForm($item);
72 72
 
73 73
                 return $this->owner->customise([
74
-                    'Title' => 'Edit ' . $item->singular_name(),
74
+                    'Title' => 'Edit '.$item->singular_name(),
75 75
                     'ManageableDataObjectForm' => $form,
76 76
                     'Item' => $item,
77 77
                 ]);
Please login to merge, or discard this patch.
src/Form/ManageableDataObjectForm.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
             $object = Injector::inst()->get($object);
27 27
         }
28 28
 
29
-		/** @var \SilverStripe\ORM\DataObject|\Dynamic\ManageableDataObject\Interfaces\ManageableDataObjectInterface $object */
29
+        /** @var \SilverStripe\ORM\DataObject|\Dynamic\ManageableDataObject\Interfaces\ManageableDataObjectInterface $object */
30 30
         $fields = $object->getFrontEndFields();
31 31
         $actions = $object->getFrontEndActions();
32 32
         if (!$actions->dataFieldByName('action_doSaveObject')) {
Please login to merge, or discard this patch.
tests/Model/SampleManageableObjectPageController.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,36 +16,36 @@
 block discarded – undo
16 16
 class SampleManageableObjectPageController extends \PageController implements TestOnly
17 17
 {
18 18
 
19
-	/**
20
-	 * @var array
21
-	 */
22
-	private static $allowed_actions = [
23
-		'Form',
24
-	];
25
-
26
-	/**
27
-	 * @var array
28
-	 */
29
-	private static $extensions = [
30
-		ManageableDataObjectExtension::class
31
-	];
32
-
33
-	/**
34
-	 * @var string
35
-	 */
36
-	private static $managed_object = SampleManageableDataObject::class;
37
-
38
-	/**
39
-	 *
40
-	 */
41
-	public function init()
42
-	{
43
-		parent::init();
44
-		Requirements::clear();
45
-	}
46
-
47
-	public function Form()
48
-	{
49
-		return ManageableDataObjectForm::create($this, 'Form', $this->config()->get('managed_object'));
50
-	}
19
+    /**
20
+     * @var array
21
+     */
22
+    private static $allowed_actions = [
23
+        'Form',
24
+    ];
25
+
26
+    /**
27
+     * @var array
28
+     */
29
+    private static $extensions = [
30
+        ManageableDataObjectExtension::class
31
+    ];
32
+
33
+    /**
34
+     * @var string
35
+     */
36
+    private static $managed_object = SampleManageableDataObject::class;
37
+
38
+    /**
39
+     *
40
+     */
41
+    public function init()
42
+    {
43
+        parent::init();
44
+        Requirements::clear();
45
+    }
46
+
47
+    public function Form()
48
+    {
49
+        return ManageableDataObjectForm::create($this, 'Form', $this->config()->get('managed_object'));
50
+    }
51 51
 }
Please login to merge, or discard this patch.
tests/Model/SampleManageableDataObject.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 class SampleManageableDataObject extends DataObject implements PermissionProvider, ManageableDataObjectInterface, TestOnly
23 23
 {
24 24
 
25
-	/**
26
-	 * @var string
27
-	 */
28
-	private static $table_name = 'SampleManageableDataObject';
25
+    /**
26
+     * @var string
27
+     */
28
+    private static $table_name = 'SampleManageableDataObject';
29 29
 
30 30
     /**
31 31
      * @var string
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
         ];
54 54
     }
55 55
 
56
-	/**
57
-	 * @param null $member
58
-	 * @param array $context
59
-	 *
60
-	 * @return bool|int
61
-	 */
56
+    /**
57
+     * @param null $member
58
+     * @param array $context
59
+     *
60
+     * @return bool|int
61
+     */
62 62
     public function canCreate($member = null, $context = array())
63 63
     {
64 64
         return Permission::check('MDO_Create', 'any', $member);
Please login to merge, or discard this patch.
tests/Model/SampleManageableObjectPage.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
  */
11 11
 class SampleManageableObjectPage extends \Page implements TestOnly
12 12
 {
13
-	/**
14
-	 * @var string
15
-	 */
16
-	private static $table_name = 'SampleManageableObjectPage';
13
+    /**
14
+     * @var string
15
+     */
16
+    private static $table_name = 'SampleManageableObjectPage';
17 17
 }
Please login to merge, or discard this patch.
tests/Extensions/ManageableObjectDataExtensionTest.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
     /**
24 24
      * @var array
25 25
      */
26
-	protected static $extra_dataobjects = [
26
+    protected static $extra_dataobjects = [
27 27
         SampleManageableDataObject::class,
28 28
         SampleManageableObjectPage::class,
29 29
     ];
30 30
 
31
-	/**
32
-	 * Ensure any current member is logged out
33
-	 */
34
-	public function logOut()
35
-	{
36
-		if ($member = Security::getCurrentUser()) {
37
-			Security::setCurrentUser(null);
38
-		}
39
-	}
31
+    /**
32
+     * Ensure any current member is logged out
33
+     */
34
+    public function logOut()
35
+    {
36
+        if ($member = Security::getCurrentUser()) {
37
+            Security::setCurrentUser(null);
38
+        }
39
+    }
40 40
 
41 41
     /**
42 42
      *
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function testGetAddLink()
54 54
     {
55
-		/** @var SampleManageableObjectPage $page */
56
-		$page = $this->objFromFixture(SampleManageableObjectPage::class, 'one');
57
-		/** @var SampleManageableDataObject $object */
58
-		$object = $this->objFromFixture(SampleManageableDataObject::class, 'one');
55
+        /** @var SampleManageableObjectPage $page */
56
+        $page = $this->objFromFixture(SampleManageableObjectPage::class, 'one');
57
+        /** @var SampleManageableDataObject $object */
58
+        $object = $this->objFromFixture(SampleManageableDataObject::class, 'one');
59 59
 
60 60
         $this->logOut();
61 61
         $this->assertFalse($object->getAddLink());
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function testGetEditLink()
74 74
     {
75
-		/** @var SampleManageableObjectPage $page */
76
-		$page = $this->objFromFixture(SampleManageableObjectPage::class, 'one');
77
-		/** @var SampleManageableDataObject $object */
78
-		$object = $this->objFromFixture(SampleManageableDataObject::class, 'one');
75
+        /** @var SampleManageableObjectPage $page */
76
+        $page = $this->objFromFixture(SampleManageableObjectPage::class, 'one');
77
+        /** @var SampleManageableDataObject $object */
78
+        $object = $this->objFromFixture(SampleManageableDataObject::class, 'one');
79 79
 
80 80
         $this->logOut();
81 81
         $this->assertFalse($object->getEditLink());
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function testGetDeleteLink()
94 94
     {
95
-    	/** @var SampleManageableObjectPage $page */
95
+        /** @var SampleManageableObjectPage $page */
96 96
         $page = $this->objFromFixture(SampleManageableObjectPage::class, 'one');
97
-		/** @var SampleManageableDataObject $object */
97
+        /** @var SampleManageableDataObject $object */
98 98
         $object = $this->objFromFixture(SampleManageableDataObject::class, 'one');
99 99
 
100 100
         $this->logOut();
Please login to merge, or discard this patch.
tests/Extensions/ManageableDataObjectExtensionTest.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * @var array
24 24
      */
25
-	protected static $extra_dataobjects = [
25
+    protected static $extra_dataobjects = [
26 26
         SampleManageableDataObject::class,
27 27
         SampleManageableObjectPage::class,
28 28
     ];
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         parent::setUp();
36 36
         // Suppress themes
37
-		SSViewer::config()->update('theme_enabled', false);
37
+        SSViewer::config()->update('theme_enabled', false);
38 38
     }
39 39
 
40 40
     /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function logOut()
44 44
     {
45 45
         if ($member = Security::getCurrentUser()) {
46
-			Security::setCurrentUser(null);
46
+            Security::setCurrentUser(null);
47 47
         }
48 48
     }
49 49
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $this->logInWithPermission('MDO_Edit');
68 68
         $object = $this->objFromFixture(SampleManageableDataObject::class, 'one');
69
-        $response = $this->get('/SampleManageableObjectPageController/edit/' . $object->ID);
69
+        $response = $this->get('/SampleManageableObjectPageController/edit/'.$object->ID);
70 70
         $this->assertEquals(200, $response->getStatusCode());
71 71
         $this->logOut();
72 72
 
73
-        $response2 = $this->get('/SampleManageableObjectPageController/edit/' . 0);
73
+        $response2 = $this->get('/SampleManageableObjectPageController/edit/'.0);
74 74
         $this->assertEquals(404, $response2->getStatusCode());
75 75
     }
76 76
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 
88 88
         $this->logInWithPermission('MDO_Delete');
89 89
 
90
-        $response404 = $this->get('/SampleManageableObjectPageController/delete/' . 0);
90
+        $response404 = $this->get('/SampleManageableObjectPageController/delete/'.0);
91 91
         $this->assertEquals(404, $response404->getStatusCode());
92 92
 
93
-        $success = $this->get('/SampleManageableObjectPageController/delete/' . $id);
93
+        $success = $this->get('/SampleManageableObjectPageController/delete/'.$id);
94 94
         $this->assertEquals(200, $success->getStatusCode());
95 95
         $this->assertNull(SampleManageableDataObject::get()->byID($id));
96 96
 
Please login to merge, or discard this patch.