Permalink
Browse files

Fixed references to deprecated APIs in docs

  • Loading branch information...
1 parent 0236a3c commit 19e087d2262f5971ce11dd713eb2aabd7a1216b3 @chillu chillu committed Jun 28, 2012
@@ -625,7 +625,7 @@ Note that its just necessary if SilverStripe is used in a language other than th
The SS_Report::register() method is deprecated. You no longer need to explicitly register reports. The CMS now
automatically picks up and adds all Report classes to the list of reports in ReportAdmin. You can choose to exclude
certain reports by using the SS_Report::add_excluded_reports() method.
-fe
+
### Removed the ability use a SQLQuery object in a SS_Report
You can no longer create reports that using the deprecated DataObject->buildSQL and DataObject->extendedSQL
@@ -2,7 +2,7 @@
The [api:DataObject::$defaults] array allows you to specify simple static values to be the default value for when a
record is created, but in many situations default values needs to be dynamically calculated. In order to do this, the
-[api:DataObjectSet->populateDefaults()] method will need to be overloaded.
+`[api:DataObject->populateDefaults()]` method will need to be overloaded.
This method is called whenever a new record is instantiated, and you must be sure to call the method on the parent
object!
@@ -13,7 +13,6 @@ A simple example is to set a field to the current date and time:
/**
* Sets the Date field to the current date.
*/
-
public function populateDefaults() {
$this->Date = date('Y-m-d');
parent::populateDefaults();
@@ -27,7 +26,6 @@ methods. For example:
* This method combines the Title of the parent object with the Title of this
* object in the FullTitle field.
*/
-
public function populateDefaults() {
if($parent = $this->Parent()) {
$this->FullTitle = $parent->Title . ': ' . $this->Title;
@@ -85,9 +85,8 @@ Create a new file called `zzz_admin/code/BookmarkedPageExtension.php` and insert
:::php
<?php
class BookmarkedPageExtension extends DataExtension {
- public function extraStatics() {
- return array('db' => array('IsBookmarked' => 'Boolean'));
- }
+ static $db = array('IsBookmarked' => 'Boolean');
+
public function updateCMSFields(&$fields) {
$fields->addFieldToTab('Root.Main',
new CheckboxField('IsBookmarked', "Show in CMS bookmarks?")
@@ -2,6 +2,10 @@
## Introduction
+<div class="warning" markdown="1">
+ This field is deprecated in favour of the new [GridField](/topics/grid-field) API.
+</div>
+
Shows a group of DataObjects as a (readonly) tabular list (similiar to `[api:TableListField]`.)
You can specify limits and filters for the resultset by customizing query-settings (mostly the ID-field on the other
@@ -128,23 +132,4 @@ Most of the time, you need to override the following methods:
* ComplexTableField->sourceItems() - querying
* ComplexTableField->DetailForm() - form output
-* ComplexTableField_Popup->saveComplexTableField() - saving
-
-### Examples
-
-* `[api:AssetTableField]`
-* `[api:MemberTableField]`
-
-## API Documentation
-
-`[api:ComplexTableField]`
-
-## Todo
-
-* Find a less fragile solution for accessing this field through the main controller and ReferencedField, e.g. build a
-seperate CTF-instance (doesn't necessarly have to be connected to the original by ReferencedField)
-* Control width/height of popup by constructor (hardcoded at the moment)
-* Integrate search from MemberTableField.php directly on `[api:ComplexTableField]`
-* Less performance-hungry implementation of detail-view paging (don't return all items on a single view)
-* Use automatic has-many and many-many functions to return a ComponentSet rather than building the join manually
-* Javascript/Ajax-Sorting (see [http://www.activewidgets.com/grid/](http://www.activewidgets.com/grid/) and [http://openrico.org/rico/livegrid.page](http://openrico.org/rico/livegrid.page))
+* ComplexTableField_Popup->saveComplexTableField() - saving
@@ -45,56 +45,42 @@ For example above we want to override Member with a Custom Member so we would wr
### Adding extra database fields
-Extra database fields can be added with a extension by defining an **extraStatics()** method. These will be added to the table of the base object - the extension will actually edit the $db, $has_one, etc static variables on load.
+Extra database fields can be added with a extension in the same manner as if they
+were placed on the `DataObject` class they're applied to. These will be added to the table of the base object - the extension will actually edit the $db, $has_one, etc static variables on load.
The function should return a map where the keys are the names of the static variables to update:
:::php
class CustomMember extends DataExtension {
-
- public function extraStatics() {
- return array(
- 'db' => array(
- 'AvatarURL' => 'Varchar',
- ),
- 'has_one' => array(
- 'RelatedMember' => 'Member',
- ),
- );
- }
+ static $db = array(
+ 'AvatarURL' => 'Varchar',
+ );
+ static $has_one = array(
+ 'RelatedMember' => 'Member',
+ );
}
-
-*NOTE*
-If you want to add has_one or db items to a particular class, then that class **must** have that static variable
-explicitly defined, even if it's just a blank array. For example, the extension method above wouldn't work if you added
-to a class that didn't have static $has_one explicitly declared on the object. This is because of PHP's crappy support
-for statics.
-
-
### Modifying CMS Fields
-The member class demonstrates an extension that allows you to update the default CMS fields for an object in a
-extension:
+The member class demonstrates an extension that allows you to update the default CMS fields for an
+object in an extension:
:::php
public function getCMSFields() {
- ...
- $this->extend('updateCMSFields', $fields);
- return $fields;
+ // ...
+ $this->extend('updateCMSFields', $fields);
+ return $fields;
}
-The $fields parameter is passed by reference, as it is an object.
+The `$`fields parameter is passed by reference, as it is an object.
:::php
public function updateCMSFields(FieldList $fields) {
- $fields->push(new TextField('Position', 'Position Title'));
- $fields->push(new UploadField('Image', 'Profile Image'));
+ $fields->push(new TextField('Position', 'Position Title'));
+ $fields->push(new UploadField('Image', 'Profile Image'));
}
-
-
### Custom database generation
Some extensions are designed to transparently add more sophisticated data-collection capabilities to your data object.
@@ -31,7 +31,7 @@ by adding, removing or configuring fields.
'IsActive' => 'Boolean'
);
public function getCMSFields() {
- return new FieldSet(
+ return new FieldList(
new CheckboxField('IsActive')
);
}
@@ -10,24 +10,6 @@ the viewer and/or perform processing steps.
* Checking for an Ajax-Request: Use Director::is_ajax() instead of checking for $_REQUEST['ajax'].
-## Redirection
-
-The `[api:Director]` class has a number of methods to facilitate 301 and 302 HTTP redirection.
-
-* **Director::redirect("action-name")**: If there's no slash in the URL passed to redirect, then it is assumed that you
-want to go to a different action on the current controller.
-* **Director::redirect("relative/url")**: If there is a slash in the URL, it's taken to be a normal URL. Relative URLs
-will are assumed to be relative to the site-root; so Director::redirect("home/") will work no matter what the current
-URL is.
-* **Director::redirect("http://www.absoluteurl.com")**: Of course, you can pass redirect() absolute URL s too.
-* **Director::redirectPerm("any-url")**: redirectPerm takes the same arguments as redirect, but it will send a 301
-(permanent) instead of a 302 (temporary) header. It improves search rankings, so this should be used whenever the
-following two conditions are true:
- * Nothing happens server-side prior to the redirection
- * The redirection will always occur
-* **Director::redirectBack()**: This will return you to the previous page. There's no permanent version of
-redirectBack().
-
## Request processing
@@ -34,8 +34,6 @@ This is a highlevel overview of available `[api:apiFormField]` subclasses. An au
* `[api:NumericField]`: Text input field with validation for numeric values.
* `[api:OptionsetField]`: Set of radio buttons designed to emulate a dropdown.
* `[api:PhoneNumberField]`: Field for displaying phone numbers. It separates the number, the area code and optionally the country code and extension.
- * `[api:UniqueRestrictedTextField]`: Text field that automatically checks that the value entered is unique for the given set of fields in a given set of tables
-
* `[api:SelectionGroup]`: SelectionGroup represents a number of fields which are selectable by a radio button that appears at the beginning of each item.
* `[api:TimeField]`: Input field with time-specific, localized validation.
@@ -72,10 +72,10 @@ You can also create your own functions by extending the image class, for example
public function Exif(){
//http://www.v-nessa.net/2010/08/02/using-php-to-extract-image-exif-data
$image = $this->AbsoluteURL;
- $d=new DataObjectSet();
+ $d=new ArrayList();
$exif = exif_read_data($image, 0, true);
foreach ($exif as $key => $section) {
- $a=new DataObjectSet();
+ $a=new ArrayList();
foreach ($section as $name => $val)
$a->push(new ArrayData(array("Title"=>$name,"Content"=>$val)));
$d->push(new ArrayData(array("Title"=>strtolower($key),"Content"=>$a)));
@@ -113,9 +113,12 @@ things, you should add appropriate `[api:Permission::checkMember()]` calls to th
}
}
- public function extraStatics() {
- // Return an array containing keys 'db', 'has_one', 'many_many', 'belongs_many_many',
- }
+ // define additional properties
+ static $db = array();
+ static $has_one = array();
+ static $has_many = array();
+ static $many_many = array();
+ static $belongs_many_many = array();
public function somethingElse() {
// You can add any other methods you like, which you can call directly on the member object.
@@ -12,7 +12,7 @@ The default output of a `[api:SearchContext]` is either a `[api:SQLQuery]` objec
In case you need multiple contexts, consider namespacing your request parameters by using `FieldList->namespace()` on
the $fields constructor parameter.
-`[api:SearchContext]` is mainly used by `[api:ModelAdmin]`, our generic data administration interface. Another
+`[api:SearchContext]` is mainly used by `[ModelAdmin](/reference/modeladmin)`, our generic data administration interface. Another
implementation can be found in generic frontend search forms through the [genericviews](http://silverstripe.org/generic-views-module) module.
## Usage
@@ -187,6 +187,6 @@ See `[api:SearchFilter]` API Documentation
## Related
-* `[api:ModelAdmin]`
+* [ModelAdmin](/reference/modeladmin)
* [RestfulServer module](https://github.com/silverstripe/silverstripe-restfulserver)
* [Tutorial: Site Search](/tutorials/4-site-search)
@@ -39,13 +39,9 @@ Create a mysite/code/CustomSiteConfig.php file.
class CustomSiteConfig extends DataExtension {
- public function extraStatics() {
- return array(
- 'db' => array(
- 'FooterContent' => 'HTMLText'
- )
- );
- }
+ static $db = array(
+ 'FooterContent' => 'HTMLText'
+ );
public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab("Root.Main", new HTMLEditorField("FooterContent", "Footer Content"));
Oops, something went wrong. Retry.

0 comments on commit 19e087d

Please sign in to comment.