mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API-CHANGE: removing protected object_to_array method (use get_object_vars instead)
This commit is contained in:
parent
5ea4615d4d
commit
eaa6c6c49d
@ -89,18 +89,6 @@ class ArrayData extends ViewableData {
|
||||
return isset($this->array[$f]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use get_object_vars($obj)
|
||||
* Converts an object with simple properties to
|
||||
* an associative array.
|
||||
*
|
||||
* @param obj $obj
|
||||
* @return array
|
||||
*/
|
||||
protected static function object_to_array($obj) {
|
||||
return get_object_vars($obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an associative array to a simple object
|
||||
*
|
||||
|
@ -67,15 +67,6 @@ class ArrayDataTest extends SapphireTest {
|
||||
$this->assertEquals("array (\n 'b' => 'bunny',\n)", $arrayData->forTemplate());
|
||||
}
|
||||
|
||||
function testObjectToArrayWorks() {
|
||||
$object = new ArrayDataTest_NonEmptyObject();
|
||||
|
||||
$array = ArrayDataTest_ArrayData_Exposed::object_to_array($object);
|
||||
|
||||
$this->assertEquals("Apple", $array['a']);
|
||||
$this->assertEquals("Banana", $array['b']);
|
||||
}
|
||||
|
||||
function testSetField() {
|
||||
$arrayData = new ArrayData(array());
|
||||
|
||||
@ -108,14 +99,6 @@ class ArrayDataTest extends SapphireTest {
|
||||
|
||||
}
|
||||
|
||||
class ArrayDataTest_ArrayData_Exposed extends ArrayData {
|
||||
|
||||
public static function object_to_array($obj) {
|
||||
return parent::object_to_array($obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ArrayDataTest_NonEmptyObject {
|
||||
|
||||
static $c = "Cucumber";
|
||||
|
Loading…
Reference in New Issue
Block a user