Permalink
Browse files

BUGFIX: Fix deprecated and removed static accessor calls

  • Loading branch information...
1 parent 9c2ebc3 commit 4315e513583ac92fb6b645ce6d4182c53cbfd24b Hamish Friedlander committed Dec 22, 2011
Showing with 7 additions and 11 deletions.
  1. +2 −7 control/RequestHandler.php
  2. +5 −4 model/DataObject.php
@@ -214,13 +214,8 @@ function handleRequest(SS_HTTPRequest $request, DataModel $model) {
* @return array|null
*/
public function allowedActions() {
- $actions = Object::combined_static(get_class($this), 'allowed_actions', 'RequestHandler');
-
- foreach($this->extension_instances as $extension) {
- if($extensionActions = Object::get_static(get_class($extension), 'allowed_actions')) {
- $actions = array_merge($actions, $extensionActions);
- }
- }
+
+ $actions = Config::inst()->get(get_class($this), 'allowed_actions');
if($actions) {
// convert all keys and values to lowercase to
@@ -1373,7 +1373,7 @@ public function getRemoteJoinField($component, $type = 'has_many') {
return substr($remoteClass, $fieldPos + 1) . 'ID';
}
- $remoteRelations = array_flip(Object::combined_static($remoteClass, 'has_one', 'DataObject'));
+ $remoteRelations = array_flip(Config::inst()->get($remoteClass, 'has_one'));
// look for remote has_one joins on this class or any parent classes
foreach(array_reverse(ClassInfo::ancestry($this)) as $class) {
@@ -1460,7 +1460,7 @@ public function has_one($component = null) {
* @return string|array
*/
public function belongs_to($component = null, $classOnly = true) {
- $belongsTo = Object::combined_static($this->class, 'belongs_to', 'DataObject');
+ $belongsTo = $this->config()->belongs_to;
if($component) {
if($belongsTo && array_key_exists($component, $belongsTo)) {
@@ -1528,7 +1528,7 @@ public function db($fieldName = null) {
* @return string|array
*/
public function has_many($component = null, $classOnly = true) {
- $hasMany = Object::combined_static($this->class, 'has_many', 'DataObject');
+ $hasMany = $this->config()->has_many;
if($component) {
if($hasMany && array_key_exists($component, $hasMany)) {
@@ -2755,7 +2755,7 @@ public function requireTable() {
// Only build the table if we've actually got fields
$fields = self::database_fields($this->class);
$extensions = self::database_extensions($this->class);
-
+
$indexes = $this->databaseIndexes();
if($fields) {
@@ -3074,6 +3074,7 @@ static function enable_subclass_access() {
* This is a map from field names to field type. The field
* type should be a class that extends .
* @var array
+ * @config
*/
public static $db = null;

0 comments on commit 4315e51

Please sign in to comment.