mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Changed places of Object::extInstance() to Object::getExtensionInstance() and added a notice if extInstance is used in future (from r100487)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105575 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
45d8433d57
commit
7e8a2c10c9
@ -1006,6 +1006,7 @@ abstract class Object {
|
|||||||
* @deprecated 2.4 Use getExtensionInstance
|
* @deprecated 2.4 Use getExtensionInstance
|
||||||
*/
|
*/
|
||||||
public function extInstance($extension) {
|
public function extInstance($extension) {
|
||||||
|
user_error('Object::extInstance() is deprecated. Please use Object::getExtensionInstance() instead.', E_USER_NOTICE);
|
||||||
return $this->getExtensionInstance($extension);
|
return $this->getExtensionInstance($extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class Versioned extends DataObjectDecorator {
|
|||||||
|
|
||||||
if($fields = DataObject::database_fields($this->owner->class)) {
|
if($fields = DataObject::database_fields($this->owner->class)) {
|
||||||
$indexes = $this->owner->databaseIndexes();
|
$indexes = $this->owner->databaseIndexes();
|
||||||
if ($suffix && ($ext = $this->owner->extInstance($allSuffixes[$suffix]))) {
|
if ($suffix && ($ext = $this->owner->getExtensionInstance($allSuffixes[$suffix]))) {
|
||||||
if (!$ext->isVersionedTable($table)) continue;
|
if (!$ext->isVersionedTable($table)) continue;
|
||||||
$ext->setOwner($this->owner);
|
$ext->setOwner($this->owner);
|
||||||
$fields = $ext->fieldsInExtraTables($suffix);
|
$fields = $ext->fieldsInExtraTables($suffix);
|
||||||
@ -417,7 +417,7 @@ class Versioned extends DataObjectDecorator {
|
|||||||
function extendWithSuffix($table) {
|
function extendWithSuffix($table) {
|
||||||
foreach (Versioned::$versionableExtensions as $versionableExtension => $suffixes) {
|
foreach (Versioned::$versionableExtensions as $versionableExtension => $suffixes) {
|
||||||
if ($this->owner->hasExtension($versionableExtension)) {
|
if ($this->owner->hasExtension($versionableExtension)) {
|
||||||
$ext = $this->owner->extInstance($versionableExtension);
|
$ext = $this->owner->getExtensionInstance($versionableExtension);
|
||||||
$ext->setOwner($this->owner);
|
$ext->setOwner($this->owner);
|
||||||
$table = $ext->extendWithSuffix($table);
|
$table = $ext->extendWithSuffix($table);
|
||||||
$ext->clearOwner();
|
$ext->clearOwner();
|
||||||
|
@ -417,7 +417,7 @@ class Group extends DataObject {
|
|||||||
* Filters to only those groups that the current user can edit
|
* Filters to only those groups that the current user can edit
|
||||||
*/
|
*/
|
||||||
function AllChildrenIncludingDeleted() {
|
function AllChildrenIncludingDeleted() {
|
||||||
$extInstance = $this->extInstance('Hierarchy');
|
$extInstance = $this->getExtensionInstance('Hierarchy');
|
||||||
$extInstance->setOwner($this);
|
$extInstance->setOwner($this);
|
||||||
$children = $extInstance->AllChildrenIncludingDeleted();
|
$children = $extInstance->AllChildrenIncludingDeleted();
|
||||||
$extInstance->clearOwner();
|
$extInstance->clearOwner();
|
||||||
|
@ -290,13 +290,13 @@ class ObjectTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link Object::hasExtension() and Object::extInstance()}
|
* Tests {@link Object::hasExtension() and Object::getExtensionInstance()}
|
||||||
*/
|
*/
|
||||||
public function testExtInstance() {
|
public function testExtInstance() {
|
||||||
$obj = new ObjectTest_ExtensionTest2();
|
$obj = new ObjectTest_ExtensionTest2();
|
||||||
|
|
||||||
$this->assertTrue($obj->hasExtension('ObjectTest_Extension'));
|
$this->assertTrue($obj->hasExtension('ObjectTest_Extension'));
|
||||||
$this->assertTrue($obj->extInstance('ObjectTest_Extension') instanceof ObjectTest_Extension);
|
$this->assertTrue($obj->getExtensionInstance('ObjectTest_Extension') instanceof ObjectTest_Extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCacheToFile() {
|
public function testCacheToFile() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user