Skip to content
This repository
Browse code

MINOR Using late static binding instead of Object::create() calls

  • Loading branch information...
commit 40d73127ae493e60b7c81991239805387aa00d2d 1 parent 6517f44
Ingo Schommer authored April 04, 2012
4  admin/code/LeftAndMain.php
@@ -969,7 +969,7 @@ function EmptyForm() {
969 969
 	 * Return the CMS's HTML-editor toolbar
970 970
 	 */
971 971
 	public function EditorToolbar() {
972  
-		return Object::create('HtmlEditorField_Toolbar', $this, "EditorToolbar");
  972
+		return HtmlEditorField_Toolbar::create($this, "EditorToolbar");
973 973
 	}
974 974
 
975 975
 	/**
@@ -1032,7 +1032,7 @@ function BatchActionsForm() {
1032 1032
 			'BatchActionsForm',
1033 1033
 			new FieldList(
1034 1034
 				new HiddenField('csvIDs'),
1035  
-				Object::create('DropdownField',
  1035
+				DropdownField::create(
1036 1036
 					'Action',
1037 1037
 					false,
1038 1038
 					$actionsMap
6  admin/code/ModelAdmin.php
@@ -117,7 +117,7 @@ function getEditForm($id = null, $fields = null) {
117 117
 		$list = $this->getList();
118 118
 		$exportButton = new GridFieldExportButton();
119 119
 		$exportButton->setExportColumns($this->getExportFields());
120  
-		$listField = Object::create('GridField',
  120
+		$listField = GridField::create(
121 121
 			$this->modelClass,
122 122
 			false,
123 123
 			$list,
@@ -180,9 +180,9 @@ public function SearchForm() {
180 180
 		$form = new Form($this, "SearchForm",
181 181
 			$context->getSearchFields(),
182 182
 			new FieldList(
183  
-				Object::create('ResetFormAction','clearsearch', _t('ModelAdmin.CLEAR_SEARCH','Clear Search'))
  183
+				ResetFormAction::create('clearsearch', _t('ModelAdmin.CLEAR_SEARCH','Clear Search'))
184 184
 					->setUseButtonTag(true)->addExtraClass('ss-ui-action-minor'),
185  
-				Object::create('FormAction', 'search', _t('MemberTableField.SEARCH', 'Search'))
  185
+				FormAction::create('search', _t('MemberTableField.SEARCH', 'Search'))
186 186
 				->setUseButtonTag(true)
187 187
 			),
188 188
 			new RequiredFields()
8  admin/code/SecurityAdmin.php
@@ -43,7 +43,7 @@ public function getEditForm($id = null, $fields = null) {
43 43
 		$record = $this->getRecord($id);
44 44
 		if($record && !$record->canView()) return Security::permissionFailure($this);
45 45
 		
46  
-		$memberList = Object::create('GridField',
  46
+		$memberList = GridField::create(
47 47
 			'Members',
48 48
 			false,
49 49
 			DataList::create('Member'),
@@ -52,8 +52,7 @@ public function getEditForm($id = null, $fields = null) {
52 52
 		)->addExtraClass("members_grid");
53 53
 		$memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator());
54 54
 
55  
-		$groupList = Object::create('GridField',
56  
-			'Groups',
  55
+		$groupList = GridField::create(			'Groups',
57 56
 			false,
58 57
 			DataList::create('Group'),
59 58
 			GridFieldConfig_RecordEditor::create()
@@ -104,8 +103,7 @@ public function getEditForm($id = null, $fields = null) {
104 103
 		
105 104
 		// Add roles editing interface
106 105
 		if(Permission::check('APPLY_ROLES')) {
107  
-			$rolesField = Object::create('GridField',
108  
-				'Roles',
  106
+			$rolesField = GridField::create(				'Roles',
109 107
 				false,
110 108
 				DataList::create('PermissionRole'),
111 109
 				GridFieldConfig_RecordEditor::create()
2  core/Convert.php
@@ -320,7 +320,7 @@ static function raw2mailto($data) {
320 320
 	 * @return string
321 321
 	 */
322 322
 	public static function raw2url($title) {
323  
-		$f = Object::create('URLSegmentFilter');
  323
+		$f = URLSegmentFilter::create();
324 324
 		return $f->filter($title);
325 325
 	}
326 326
 }
6  core/Object.php
@@ -87,7 +87,7 @@ public function config() {
87 87
 	 * or calling on Object and passing the class name as the first parameter. The following
88 88
 	 * are equivalent:
89 89
 	 *    $list = DataList::create('SiteTree');
90  
-	 *    $list = Object::create('DataList', 'SiteTree');
  90
+	 *    $list = DataList::create('SiteTree');
91 91
 	 *
92 92
 	 * @param string $class the class name
93 93
 	 * @param mixed $arguments,... arguments to pass to the constructor
@@ -121,7 +121,7 @@ public static function create() {
121 121
 	 * are respected.
122 122
 	 * 
123 123
 	 * `Object::create_from_string("Versioned('Stage','Live')")` will return the result of
124  
-	 * `Object::create('Versioned', 'Stage', 'Live);`
  124
+	 * `Versioned::create('Stage', 'Live);`
125 125
 	 * 
126 126
 	 * It is designed for simple, clonable objects.  The first time this method is called for a given
127 127
 	 * string it is cached, and clones of that object are returned.
@@ -130,7 +130,7 @@ public static function create() {
130 130
 	 * impossible to pass null as the firstArg argument.
131 131
 	 * 
132 132
 	 * `Object::create_from_string("Varchar(50)", "MyField")` will return the result of
133  
-	 * `Object::create('Vachar', 'MyField', '50');`
  133
+	 * `Vachar::create('MyField', '50');`
134 134
 	 * 
135 135
 	 * Arguments are always strings, although this is a quirk of the current implementation rather
136 136
 	 * than something that can be relied upon.
22  dev/DevelopmentAdmin.php
@@ -92,7 +92,7 @@ function index() {
92 92
 			// This action is sake-only right now.
93 93
 			unset($actions["modules/add"]);
94 94
 			
95  
-			$renderer = Object::create('DebugView');
  95
+			$renderer = DebugView::create();
96 96
 			$renderer->writeHeader();
97 97
 			$renderer->writeInfo("Sapphire Development Tools", Director::absoluteBaseURL());
98 98
 			$base = Director::baseURL();
@@ -116,33 +116,33 @@ function index() {
116 116
 	}
117 117
 	
118 118
 	function tests($request) {
119  
-		return Object::create('TestRunner');
  119
+		return TestRunner::create();
120 120
 	}
121 121
 	
122 122
 	function jstests($request) {
123  
-		return Object::create('JSTestRunner');
  123
+		return JSTestRunner::create();
124 124
 	}
125 125
 	
126 126
 	function tasks() {
127  
-		return Object::create('TaskRunner');
  127
+		return TaskRunner::create();
128 128
 	}
129 129
 	
130 130
 	function viewmodel() {
131  
-		return Object::create('ModelViewer');
  131
+		return ModelViewer::create();
132 132
 	}
133 133
 	
134 134
 	function build($request) {
135 135
 		if(Director::is_cli()) {
136  
-			$da = Object::create('DatabaseAdmin');
  136
+			$da = DatabaseAdmin::create();
137 137
 			return $da->handleRequest($request, $this->model);
138 138
 		} else {
139  
-			$renderer = Object::create('DebugView');
  139
+			$renderer = DebugView::create();
140 140
 			$renderer->writeHeader();
141 141
 			$renderer->writeInfo("Environment Builder", Director::absoluteBaseURL());
142 142
 			echo "<div style=\"margin: 0 2em\">";
143 143
 			echo "<div class=\"status pending\"><h2 class='buildProgress'>Database is building.... Check below for any errors</h2><h2 class='buildCompleted'>Database has been built successfully</h2></div>";
144 144
 
145  
-			$da = Object::create('DatabaseAdmin');
  145
+			$da = DatabaseAdmin::create();
146 146
 			return $da->handleRequest($request, $this->model);
147 147
 
148 148
 			echo "</div>";
@@ -157,10 +157,10 @@ function build($request) {
157 157
 	 *		'build/defaults' => 'buildDefaults',
158 158
 	 */
159 159
 	function buildDefaults() {
160  
-		$da = Object::create('DatabaseAdmin');
  160
+		$da = DatabaseAdmin::create();
161 161
 
162 162
 		if (!Director::is_cli()) {
163  
-			$renderer = Object::create('DebugView');
  163
+			$renderer = DebugView::create();
164 164
 			$renderer->writeHeader();
165 165
 			$renderer->writeInfo("Defaults Builder", Director::absoluteBaseURL());
166 166
 			echo "<div style=\"margin: 0 2em\">";
@@ -189,6 +189,6 @@ function errors() {
189 189
 	}
190 190
 	
191 191
 	function viewcode($request) {
192  
-		return Object::create('CodeViewer');
  192
+		return CodeViewer::create();
193 193
 	}
194 194
 }
2  docs/en/topics/rich-text-editing.md
Source Rendered
@@ -93,7 +93,7 @@ of the CMS you have to take care of instanciation yourself:
93 93
 	// File: mysite/code/MyController.php
94 94
 	class MyObjectController extends Controller {
95 95
 		public function EditorToolbar() {
96  
-			return Object::create('HtmlEditorField_Toolbar', $this, "EditorToolbar");
  96
+			return HtmlEditorField_Toolbar::create($this, "EditorToolbar");
97 97
 		}
98 98
 	}
99 99
 
6  docs/en/topics/security.md
Source Rendered
@@ -213,8 +213,8 @@ PHP:
213 213
 		public function search($request) {
214 214
 			$htmlTitle = '<p>Your results for:' . Convert::raw2xml($request->getVar('Query')) . '</p>';
215 215
 			return $this->customise(array(
216  
-				'Query' => DBField::create('Text', $request->getVar('Query')),
217  
-				'HTMLTitle' => DBField::create('HTMLText', $htmlTitle)
  216
+				'Query' => Text::create($request->getVar('Query')),
  217
+				'HTMLTitle' => HTMLText::create($htmlTitle)
218 218
 			));
219 219
 		}
220 220
 	}
@@ -243,7 +243,7 @@ PHP:
243 243
 			$rssRelativeLink = "/rss?Query=" . urlencode($_REQUEST['query']) . "&sortOrder=asc";
244 244
 			$rssLink = Controller::join_links($this->Link(), $rssRelativeLink);
245 245
 			return $this->customise(array(
246  
-				"RSSLink" => DBField::create("Text", $rssLink),
  246
+				"RSSLink" => Text::create($rssLink),
247 247
 			));
248 248
 		}
249 249
 	}
10  filesystem/File.php
@@ -349,12 +349,12 @@ function getCMSFields($params = null) {
349 349
 		}
350 350
 
351 351
 		//create the file attributes in a FieldGroup
352  
-		$filePreview = FormField::create('CompositeField', 
353  
-			FormField::create('CompositeField',
  352
+		$filePreview = CompositeField::create(
  353
+			CompositeField::create(
354 354
 				$previewField
355 355
 			)->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'),
356  
-			FormField::create('CompositeField',
357  
-				FormField::create('CompositeField', 
  356
+			CompositeField::create(
  357
+				CompositeField::create(
358 358
 					new ReadonlyField("FileType", _t('AssetTableField.TYPE','File type') . ':'),
359 359
 					new ReadonlyField("Size", _t('AssetTableField.SIZE','File size') . ':', $this->getSize()),
360 360
 					$urlField = new ReadonlyField('ClickableURL', _t('AssetTableField.URL','URL'),
@@ -566,7 +566,7 @@ function setName($name) {
566 566
 		if(!$name) $name = $this->Title;
567 567
 
568 568
 		// Fix illegal characters
569  
-		$filter = Object::create('FileNameFilter');
  569
+		$filter = FileNameFilter::create();
570 570
 		$name = $filter->filter($name);
571 571
 
572 572
 		// We might have just turned it blank, so check again.
4  filesystem/FileNameFilter.php
@@ -26,7 +26,7 @@
26 26
  * 
27 27
  * See {@link URLSegmentFilter} for a more generic implementation.
28 28
  */
29  
-class FileNameFilter {
  29
+class FileNameFilter extends Object {
30 30
 	
31 31
 	/**
32 32
 	 * @var Boolean
@@ -100,7 +100,7 @@ function getReplacements() {
100 100
 	 */
101 101
 	function getTransliterator() {
102 102
 		if($this->transliterator === null && self::$default_use_transliterator) {
103  
-			$this->transliterator = Object::create('Transliterator');
  103
+			$this->transliterator = Transliterator::create();
104 104
 		} 
105 105
 		return $this->transliterator;
106 106
 	}
2  filesystem/Folder.php
@@ -232,7 +232,7 @@ function addUploadToFolder($tmpFile) {
232 232
 		// $parentFolder = Folder::findOrMake("Uploads");
233 233
 
234 234
 		// Generate default filename
235  
-		$nameFilter = Object::create('FileNameFilter');
  235
+		$nameFilter = FileNameFilter::create();
236 236
 		$file = $nameFilter->filter($tmpFile['name']);
237 237
 		while($file[0] == '_' || $file[0] == '.') {
238 238
 			$file = substr($file, 1);
2  filesystem/Upload.php
@@ -131,7 +131,7 @@ function load($tmpFile, $folderPath = false) {
131 131
 		}
132 132
 
133 133
 		// Generate default filename
134  
-		$nameFilter = Object::create('FileNameFilter');
  134
+		$nameFilter = FileNameFilter::create();
135 135
 		$file = $nameFilter->filter($tmpFile['name']);
136 136
 		$fileName = basename($file);
137 137
 
2  forms/ComplexTableField.php
@@ -816,7 +816,7 @@ function __construct($controller, $name, $fields, $validator, $readonly, $dataOb
816 816
 		$actions = new FieldList();	
817 817
 		if(!$readonly) {
818 818
 			$actions->push(
819  
-				Object::create('FormAction', 
  819
+				FormAction::create(
820 820
 					"saveComplexTableField", 
821 821
 					_t('CMSMain.SAVE', 'Save')
822 822
 				)
4  forms/DateField.php
@@ -112,7 +112,7 @@ function __construct($name, $title = null, $value = null) {
112 112
 
113 113
 	function FieldHolder() {
114 114
 		// TODO Replace with properly extensible view helper system 
115  
-		$d = Object::create('DateField_View_JQuery', $this); 
  115
+		$d = DateField_View_JQuery::create($this); 
116 116
 		$d->onBeforeRender(); 
117 117
 		$html = parent::FieldHolder(); 
118 118
 		$html = $d->onAfterRender($html); 
@@ -459,7 +459,7 @@ function validate($validator) {
459 459
  * @package sapphire
460 460
  * @subpackage forms
461 461
  */
462  
-class DateField_View_JQuery {
  462
+class DateField_View_JQuery extends Object {
463 463
 	
464 464
 	protected $field;
465 465
 	
4  forms/DatetimeField.php
@@ -57,8 +57,8 @@ class DatetimeField extends FormField {
57 57
 	function __construct($name, $title = null, $value = ""){
58 58
 		$this->config = self::$default_config;
59 59
 		
60  
-		$this->dateField = Object::create('DateField', $name . '[date]', false);
61  
-		$this->timeField = Object::create('TimeField', $name . '[time]', false);
  60
+		$this->dateField = DateField::create($name . '[date]', false);
  61
+		$this->timeField = TimeField::create($name . '[time]', false);
62 62
 		$this->timezoneField = new HiddenField($this->getName() . '[timezone]');
63 63
 		
64 64
 		parent::__construct($name, $title, $value);
2  forms/HtmlEditorField.php
@@ -322,7 +322,7 @@ function LinkForm() {
322 322
 				)
323 323
 			),
324 324
 			new FieldList(
325  
-				Object::create('ResetFormAction', 'remove', _t('HtmlEditorField.BUTTONREMOVELINK', 'Remove link'))
  325
+				ResetFormAction::create('remove', _t('HtmlEditorField.BUTTONREMOVELINK', 'Remove link'))
326 326
 					->addExtraClass('ss-ui-action-destructive')
327 327
 					->setUseButtonTag(true)
328 328
 				,
4  forms/UploadField.php
@@ -407,7 +407,7 @@ public function handleItem(SS_HTTPRequest $request) {
407 407
 	 * @return UploadField_ItemHandler
408 408
 	 */
409 409
 	public function getItemHandler($itemID) {
410  
-		return Object::create('UploadField_ItemHandler', $this, $itemID);
  410
+		return UploadField_ItemHandler::create($this, $itemID);
411 411
 	}
412 412
 
413 413
 	/**
@@ -415,7 +415,7 @@ public function getItemHandler($itemID) {
415 415
 	 * @return UploadField_ItemHandler
416 416
 	 */
417 417
 	public function handleSelect(SS_HTTPRequest $request) {
418  
-		return Object::create('UploadField_SelectHandler', $this, $this->folderName);
  418
+		return UploadField_SelectHandler::create($this, $this->folderName);
419 419
 	}
420 420
 
421 421
 	/**
4  forms/gridfield/GridFieldDeleteAction.php
@@ -98,7 +98,7 @@ public function getActions($gridField) {
98 98
 	 */
99 99
 	public function getColumnContent($gridField, $record, $columnName) {
100 100
 		if($this->removeRelation) {
101  
-			$field = Object::create('GridField_FormAction', $gridField, 'UnlinkRelation'.$record->ID, false, "unlinkrelation", array('RecordID' => $record->ID))
  101
+			$field = GridField_FormAction::create($gridField, 'UnlinkRelation'.$record->ID, false, "unlinkrelation", array('RecordID' => $record->ID))
102 102
 				->addExtraClass('gridfield-button-unlink')
103 103
 				->setAttribute('title', _t('GridAction.UnlinkRelation', "Unlink"))
104 104
 				->setAttribute('data-icon', 'chain--minus');
@@ -106,7 +106,7 @@ public function getColumnContent($gridField, $record, $columnName) {
106 106
 			if(!$record->canDelete()) {
107 107
 				return;
108 108
 			}
109  
-			$field = Object::create('GridField_FormAction', $gridField,  'DeleteRecord'.$record->ID, false, "deleterecord", array('RecordID' => $record->ID))
  109
+			$field = GridField_FormAction::create($gridField,  'DeleteRecord'.$record->ID, false, "deleterecord", array('RecordID' => $record->ID))
110 110
 				->addExtraClass('gridfield-button-delete')
111 111
 				->setAttribute('title', _t('GridAction.Delete', "Delete"))
112 112
 				->setAttribute('data-icon', 'decline');
4  forms/gridfield/GridFieldFilterHeader.php
@@ -123,11 +123,11 @@ public function getHTMLFragments($gridField) {
123 123
 
124 124
 				$field = new FieldGroup(
125 125
 					$field,
126  
-					Object::create('GridField_FormAction', $gridField, 'filter', false, 'filter', null)
  126
+					GridField_FormAction::create($gridField, 'filter', false, 'filter', null)
127 127
 						->addExtraClass('ss-gridfield-button-filter')
128 128
 						->setAttribute('title', _t('GridField.Filter', "Filter"))
129 129
 						,
130  
-					Object::create('GridField_FormAction', $gridField, 'reset', false, 'reset', null)
  130
+					GridField_FormAction::create($gridField, 'reset', false, 'reset', null)
131 131
 						->addExtraClass('ss-gridfield-button-reset')
132 132
 						->setAttribute('title', _t('GridField.ResetFilter', "Reset"))
133 133
 				);
2  model/Image.php
@@ -153,7 +153,7 @@ function loadUploadedImage($tmpFile) {
153 153
 		}
154 154
 
155 155
 		// Generate default filename
156  
-		$nameFilter = Object::create('FileNameFilter');
  156
+		$nameFilter = FileNameFilter::create();
157 157
 		$file = $nameFilter->filter($tmpFile['name']);
158 158
 		if(!$file) $file = "file.jpg";
159 159
 		
8  model/Transliterator.php
@@ -13,17 +13,13 @@
13 13
  * @package sapphire
14 14
  * @subpackage model
15 15
  */
16  
-class Transliterator {
  16
+class Transliterator extends Object {
17 17
 	/**
18 18
 	 * Allow the use of iconv() to perform transliteration.  Set to false to disable.
19 19
 	 * Even if this variable is true, iconv() won't be used if it's not installed.
20 20
 	 */
21 21
 	static $use_iconv = false;
22  
-	
23  
-	function __construct() {
24  
-		// A constructor is necessary for Object::create() to work
25  
-	}
26  
-	
  22
+		
27 23
 	/**
28 24
 	 * Convert the given utf8 string to a safe ASCII source
29 25
 	 */
9  model/URLSegmentFilter.php
@@ -14,12 +14,7 @@
14 14
  * 
15 15
  * See {@link FileNameFilter} for similar implementation for filesystem-based URLs.
16 16
  */
17  
-class URLSegmentFilter {
18  
-	
19  
-	/**
20  
-	 * Necessary to support {@link Object::create()}
21  
-	 */
22  
-	function __construct() {}
  17
+class URLSegmentFilter extends Object {
23 18
 	
24 19
 	/**
25 20
 	 * @var Boolean
@@ -104,7 +99,7 @@ function getReplacements() {
104 99
 	 */
105 100
 	function getTransliterator() {
106 101
 		if($this->transliterator === null && self::$default_use_transliterator) {
107  
-			$this->transliterator = Object::create('Transliterator');
  102
+			$this->transliterator = Transliterator::create();
108 103
 		} 
109 104
 		return $this->transliterator;
110 105
 	}
7  security/Group.php
@@ -66,8 +66,7 @@ public function getCMSFields($params = null) {
66 66
 			new TabSet("Root",
67 67
 				new Tab('Members', _t('SecurityAdmin.MEMBERS', 'Members'),
68 68
 					new TextField("Title", $this->fieldLabel('Title')),
69  
-					$parentidfield = Object::create('DropdownField',
70  
-						'ParentID', 
  69
+					$parentidfield = DropdownField::create(						'ParentID', 
71 70
 						$this->fieldLabel('Parent'), 
72 71
 						DataList::create('Group')->exclude('ID', $this->ID)->map('ID', 'Breadcrumbs')
73 72
 					)->setEmptyString(' ')
@@ -100,7 +99,7 @@ public function getCMSFields($params = null) {
100 99
 			$config->getComponentByType('GridFieldAddExistingAutocompleter')
101 100
 				->setResultsFormat('$Title ($Email)')->setSearchFields(array('FirstName', 'Surname', 'Email'));
102 101
 			$config->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator());
103  
-			$memberList = Object::create('GridField', 'Members',false, $this->Members(), $config)->addExtraClass('members_grid');
  102
+			$memberList = GridField::create('Members',false, $this->Members(), $config)->addExtraClass('members_grid');
104 103
 			// @todo Implement permission checking on GridField
105 104
 			//$memberList->setPermissions(array('edit', 'delete', 'export', 'add', 'inlineadd'));
106 105
 			$fields->addFieldToTab('Root.Members', $memberList);
@@ -164,7 +163,7 @@ public function getCMSFields($params = null) {
164 163
 				$inheritedRoleIDs = array();
165 164
 			}
166 165
 
167  
-			$rolesField = Object::create('ListboxField', 'Roles', false, $allRoles->map()->toArray())
  166
+			$rolesField = ListboxField::create('Roles', false, $allRoles->map()->toArray())
168 167
 					->setMultiple(true)
169 168
 					->setDefaultItems($groupRoleIDs)
170 169
 					->setAttribute('data-placeholder', _t('Group.AddRole', 'Add a role for this group'))
10  security/Member.php
@@ -151,7 +151,7 @@ function requireDefaultRecords() {
151 151
 		if(!$admins) {
152 152
 			// Leave 'Email' and 'Password' are not set to avoid creating
153 153
 			// persistent logins in the database. See Security::setDefaultAdmin().
154  
-			$admin = Object::create('Member');
  154
+			$admin = Member::create();
155 155
 			$admin->FirstName = _t('Member.DefaultAdminFirstname', 'Default Admin');
156 156
 			$admin->write();
157 157
 			$admin->Groups()->add($adminGroup);
@@ -480,13 +480,13 @@ static function member_from_autologinhash($RAW_hash, $login = false) {
480 480
 	function sendInfo($type = 'signup', $data = null) {
481 481
 		switch($type) {
482 482
 			case "signup":
483  
-				$e = Object::create('Member_SignupEmail');
  483
+				$e = Member_SignupEmail::create();
484 484
 				break;
485 485
 			case "changePassword":
486  
-				$e = Object::create('Member_ChangePasswordEmail');
  486
+				$e = Member_ChangePasswordEmail::create();
487 487
 				break;
488 488
 			case "forgotPassword":
489  
-				$e = Object::create('Member_ForgotPasswordEmail');
  489
+				$e = Member_ForgotPasswordEmail::create();
490 490
 				break;
491 491
 		}
492 492
 
@@ -1134,7 +1134,7 @@ public function getCMSFields($params = null) {
1134 1134
 			$groupsMap = DataList::create('Group')->map('ID', 'Breadcrumbs')->toArray();
1135 1135
 			asort($groupsMap);
1136 1136
 			$fields->addFieldToTab('Root.Main',
1137  
-				Object::create('ListboxField', 'DirectGroups', singleton('Group')->i18n_plural_name())
  1137
+				ListboxField::create('DirectGroups', singleton('Group')->i18n_plural_name())
1138 1138
 					->setMultiple(true)->setSource($groupsMap)
1139 1139
 			);
1140 1140
 
3  security/Security.php
@@ -448,8 +448,7 @@ public function lostpassword() {
448 448
 	 * @return Form Returns the lost password form
449 449
 	 */
450 450
 	public function LostPasswordForm() {
451  
-		return Object::create('MemberLoginForm',
452  
-			$this,
  451
+		return MemberLoginForm::create(			$this,
453 452
 			'LostPasswordForm',
454 453
 			new FieldList(
455 454
 				new EmailField('Email', _t('Member.EMAIL', 'Email'))
14  tests/core/ObjectTest.php
@@ -113,7 +113,7 @@ function testStaticSettingOnInstances() {
113 113
 	 * Tests that {@link Object::create()} correctly passes all arguments to the new object
114 114
 	 */
115 115
 	public function testCreateWithArgs() {
116  
-		$createdObj = Object::create('ObjectTest_CreateTest', 'arg1', 'arg2', array(), null, 'arg5');
  116
+		$createdObj = ObjectTest_CreateTest::create('arg1', 'arg2', array(), null, 'arg5');
117 117
 		$this->assertEquals($createdObj->constructArguments, array('arg1', 'arg2', array(), null, 'arg5'));
118 118
 		
119 119
 		$strongObj = Object::strong_create('ObjectTest_CreateTest', 'arg1', 'arg2', array(), null, 'arg5');
@@ -129,18 +129,18 @@ public function testCreateLateStaticBinding() {
129 129
 	 * Tests that {@link Object::useCustomClass()} correnctly replaces normal and strong objects
130 130
 	 */
131 131
 	public function testUseCustomClass() {
132  
-		$obj1 = Object::create('ObjectTest_CreateTest');
  132
+		$obj1 = ObjectTest_CreateTest::create();
133 133
 		$this->assertTrue($obj1 instanceof ObjectTest_CreateTest);
134 134
 		
135 135
 		Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2');
136  
-		$obj2 = Object::create('ObjectTest_CreateTest');
  136
+		$obj2 = ObjectTest_CreateTest::create();
137 137
 		$this->assertTrue($obj2 instanceof ObjectTest_CreateTest2);
138 138
 		
139 139
 		$obj2_2 = Object::strong_create('ObjectTest_CreateTest');
140 140
 		$this->assertTrue($obj2_2 instanceof ObjectTest_CreateTest);
141 141
 		
142 142
 		Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest3', true);
143  
-		$obj3 = Object::create('ObjectTest_CreateTest');
  143
+		$obj3 = ObjectTest_CreateTest::create();
144 144
 		$this->assertTrue($obj3 instanceof ObjectTest_CreateTest3);
145 145
 		
146 146
 		$obj3_2 = Object::strong_create('ObjectTest_CreateTest');
@@ -269,12 +269,12 @@ public function testRemoveExtension() {
269 269
 	}
270 270
 	
271 271
 	public function testParentClass() {
272  
-		$this->assertEquals(Object::create('ObjectTest_MyObject')->parentClass(), 'Object');
  272
+		$this->assertEquals(ObjectTest_MyObject::create()->parentClass(), 'Object');
273 273
 	}
274 274
 	
275 275
 	public function testIsA() {
276  
-		$this->assertTrue(Object::create('ObjectTest_MyObject') instanceof Object);
277  
-		$this->assertTrue(Object::create('ObjectTest_MyObject') instanceof ObjectTest_MyObject);
  276
+		$this->assertTrue(ObjectTest_MyObject::create() instanceof Object);
  277
+		$this->assertTrue(ObjectTest_MyObject::create() instanceof ObjectTest_MyObject);
278 278
 	}
279 279
 	
280 280
 	/**
6  tests/forms/gridfield/GridFieldDetailFormTest.php
@@ -144,7 +144,7 @@ function getCMSFields($params = null) {
144 144
 		$fields = parent::getCMSFields($params);
145 145
 		// TODO No longer necessary once FormScaffolder uses GridField
146 146
 		$fields->replaceField('Categories',
147  
-			Object::create('GridField', 'Categories', 'Categories',
  147
+			GridField::create('Categories', 'Categories',
148 148
 				$this->Categories(),
149 149
 				GridFieldConfig_RelationEditor::create()
150 150
 			)
@@ -166,7 +166,7 @@ function getCMSFields($params = null) {
166 166
 		$fields = parent::getCMSFields($params);
167 167
 		// TODO No longer necessary once FormScaffolder uses GridField
168 168
 		$fields->replaceField('People',
169  
-			Object::create('GridField', 'People', 'People',
  169
+			GridField::create('People', 'People',
170 170
 				$this->People(),
171 171
 				GridFieldConfig_RelationEditor::create()
172 172
 			)
@@ -188,7 +188,7 @@ function getCMSFields($params = null) {
188 188
 		$fields = parent::getCMSFields($params);
189 189
 		// TODO No longer necessary once FormScaffolder uses GridField
190 190
 		$fields->replaceField('People',
191  
-			Object::create('GridField', 'People', 'People',
  191
+			GridField::create('People', 'People',
192 192
 				$this->People(),
193 193
 				GridFieldConfig_RelationEditor::create()
194 194
 			)
2  view/ViewableData.php
@@ -717,7 +717,7 @@ public function forTemplate($field = null) {
717 717
 		
718 718
 		// check for an extra attached data
719 719
 		if($this->object->hasMethod('data') && $this->object->data() != $this->object) {
720  
-			$debug .= Object::create('ViewableData_Debugger', $this->object->data())->forTemplate();
  720
+			$debug .= ViewableData_Debugger::create($this->object->data())->forTemplate();
721 721
 		}
722 722
 		
723 723
 		return $debug;

0 notes on commit 40d7312

Please sign in to comment.
Something went wrong with that request. Please try again.