Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
e40eb197
Commit
e40eb197
authored
Sep 23, 2013
by
alexpott
Browse files
Issue
#2086095
by yched, swentel, Hydra: Fixed Remove remaining references to field_sql_storage().
parent
47ec9cf0
Changes
11
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Entity/DatabaseStorageController.php
View file @
e40eb197
...
...
@@ -867,22 +867,22 @@ public function onInstanceDelete(FieldInstanceInterface $instance) {
* {@inheritdoc}
*/
public
function
onBundleRename
(
$bundle
,
$bundle_new
)
{
// We need to account for deleted or inactive fields and instances.
$instances
=
field_read_instances
(
array
(
'entity_type'
=>
$this
->
entityType
,
'bundle'
=>
$bundle_new
),
array
(
'include_deleted'
=>
TRUE
,
'include_inactive'
=>
TRUE
));
// We need to account for deleted or inactive fields and instances. The
// method runs before the instance definitions are updated, so we need to
// fetch them using the old bundle name.
$instances
=
field_read_instances
(
array
(
'entity_type'
=>
$this
->
entityType
,
'bundle'
=>
$bundle
),
array
(
'include_deleted'
=>
TRUE
,
'include_inactive'
=>
TRUE
));
foreach
(
$instances
as
$instance
)
{
$field
=
$instance
->
getField
();
if
(
$field
[
'storage'
][
'type'
]
==
'field_sql_storage'
)
{
$table_name
=
static
::
_fieldTableName
(
$field
);
$revision_name
=
static
::
_fieldRevisionTableName
(
$field
);
$this
->
database
->
update
(
$table_name
)
->
fields
(
array
(
'bundle'
=>
$bundle_new
))
->
condition
(
'bundle'
,
$bundle
)
->
execute
();
$this
->
database
->
update
(
$revision_name
)
->
fields
(
array
(
'bundle'
=>
$bundle_new
))
->
condition
(
'bundle'
,
$bundle
)
->
execute
();
}
$table_name
=
static
::
_fieldTableName
(
$field
);
$revision_name
=
static
::
_fieldRevisionTableName
(
$field
);
$this
->
database
->
update
(
$table_name
)
->
fields
(
array
(
'bundle'
=>
$bundle_new
))
->
condition
(
'bundle'
,
$bundle
)
->
execute
();
$this
->
database
->
update
(
$revision_name
)
->
fields
(
array
(
'bundle'
=>
$bundle_new
))
->
condition
(
'bundle'
,
$bundle
)
->
execute
();
}
}
...
...
core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerInterface.php
View file @
e40eb197
...
...
@@ -81,6 +81,9 @@ public function onBundleCreate($bundle);
/**
* Allows reaction to a bundle being renamed.
*
* This method runs before field instance definitions are updated with the new
* bundle name.
*
* @param string $bundle
* The name of the bundle being renamed.
* @param string $bundle_new
...
...
@@ -91,6 +94,8 @@ public function onBundleRename($bundle, $bundle_new);
/**
* Allows reaction to a bundle being deleted.
*
* This method runs before field and instance definitions are deleted.
*
* @param string $bundle
* The name of the bundle being deleted.
*/
...
...
core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php
View file @
e40eb197
...
...
@@ -30,7 +30,7 @@ abstract class NormalizerTestBase extends DrupalUnitTestBase {
*
* @var array
*/
public
static
$modules
=
array
(
'entity'
,
'entity_test'
,
'entity_reference'
,
'field'
,
'field_sql_storage'
,
'hal'
,
'language'
,
'rest'
,
'serialization'
,
'system'
,
'text'
,
'user'
,
'filter'
);
public
static
$modules
=
array
(
'entity'
,
'entity_test'
,
'entity_reference'
,
'field'
,
'hal'
,
'language'
,
'rest'
,
'serialization'
,
'system'
,
'text'
,
'user'
,
'filter'
);
/**
* The mock serializer.
...
...
core/modules/node/lib/Drupal/node/Tests/Config/NodeImportChangeTest.php
View file @
e40eb197
...
...
@@ -19,7 +19,7 @@ class NodeImportChangeTest extends DrupalUnitTestBase {
*
* @var array
*/
public
static
$modules
=
array
(
'node'
,
'entity'
,
'field'
,
'text'
,
'field_sql_storage'
,
'system'
,
'node_test_config'
);
public
static
$modules
=
array
(
'node'
,
'entity'
,
'field'
,
'text'
,
'system'
,
'node_test_config'
);
/**
* Set the default field storage backend for fields created during tests.
...
...
core/modules/node/lib/Drupal/node/Tests/Config/NodeImportCreateTest.php
View file @
e40eb197
...
...
@@ -19,7 +19,7 @@ class NodeImportCreateTest extends DrupalUnitTestBase {
*
* @var array
*/
public
static
$modules
=
array
(
'node'
,
'entity'
,
'field'
,
'text'
,
'field_sql_storage'
,
'system'
);
public
static
$modules
=
array
(
'node'
,
'entity'
,
'field'
,
'text'
,
'system'
);
/**
* Set the default field storage backend for fields created during tests.
...
...
core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php
View file @
e40eb197
...
...
@@ -108,7 +108,7 @@ function testEnableModulesInstall() {
*/
function
testEnableModulesInstallContainer
()
{
// Install Node module.
$this
->
enableModules
(
array
(
'field_sql_storage'
,
'field'
,
'node'
));
$this
->
enableModules
(
array
(
'field'
,
'node'
));
$this
->
installSchema
(
'node'
,
array
(
'node'
,
'node_field_data'
));
// Perform an entity query against node.
...
...
@@ -206,12 +206,12 @@ function testEnableModulesFixedList() {
$this
->
assertTrue
(
TRUE
==
entity_get_info
(
'entity_test'
));
// Load some additional modules; entity_test should still exist.
$this
->
enableModules
(
array
(
'entity'
,
'field'
,
'field_sql_storage'
,
'text'
,
'entity_test'
));
$this
->
enableModules
(
array
(
'entity'
,
'field'
,
'text'
,
'entity_test'
));
$this
->
assertEqual
(
$this
->
container
->
get
(
'module_handler'
)
->
moduleExists
(
'entity_test'
),
TRUE
);
$this
->
assertTrue
(
TRUE
==
entity_get_info
(
'entity_test'
));
// Install some other modules; entity_test should still exist.
$this
->
container
->
get
(
'module_handler'
)
->
install
(
array
(
'field'
,
'field_sql_storage'
,
'field_test'
),
FALSE
);
$this
->
container
->
get
(
'module_handler'
)
->
install
(
array
(
'field'
,
'field_test'
),
FALSE
);
$this
->
assertEqual
(
$this
->
container
->
get
(
'module_handler'
)
->
moduleExists
(
'entity_test'
),
TRUE
);
$this
->
assertTrue
(
TRUE
==
entity_get_info
(
'entity_test'
));
...
...
core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php
View file @
e40eb197
...
...
@@ -6,9 +6,6 @@
*/
namespace
Drupal\system\Tests\Entity
;
use
Drupal\field_sql_storage
\
Entity\ConditionAggregate
;
use
Drupal\simpletest\DrupalUnitTestBase
;
/**
* Defines a test for testing aggregation support for entity query.
*
...
...
core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
View file @
e40eb197
...
...
@@ -20,7 +20,7 @@ class EntityQueryRelationshipTest extends EntityUnitTestBase {
public
static
$modules
=
array
(
'taxonomy'
,
'options'
);
/**
* @var \Drupal\
field_sql_storag
e\Entity\QueryFactory
* @var \Drupal\
Cor
e\Entity\
Query\
QueryFactory
*/
protected
$factory
;
...
...
core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php
View file @
e40eb197
...
...
@@ -19,7 +19,7 @@ class FieldAccessTest extends DrupalUnitTestBase {
*
* @var array
*/
public
static
$modules
=
array
(
'entity'
,
'entity_test'
,
'field'
,
'field_sql_storage'
,
'system'
,
'text'
,
'filter'
,
'user'
);
public
static
$modules
=
array
(
'entity'
,
'entity_test'
,
'field'
,
'system'
,
'text'
,
'filter'
,
'user'
);
/**
* Holds the currently active global user ID that initiated the test run.
...
...
core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php
View file @
e40eb197
...
...
@@ -26,7 +26,7 @@ class FieldSqlStorageTest extends EntityUnitTestBase {
*
* @var array
*/
public
static
$modules
=
array
(
'field'
,
'field_test'
,
'text'
,
'number'
,
'entity_test'
);
public
static
$modules
=
array
(
'system'
,
'field'
,
'field_test'
,
'text'
,
'number'
,
'entity_test'
);
/**
* The name of the created field.
...
...
@@ -67,6 +67,7 @@ public static function getInfo() {
function
setUp
()
{
parent
::
setUp
();
$this
->
installSchema
(
'entity_test'
,
array
(
'entity_test_rev'
,
'entity_test_rev_revision'
));
$this
->
installSchema
(
'system'
,
array
(
'variable'
));
$entity_type
=
'entity_test_rev'
;
$this
->
field_name
=
strtolower
(
$this
->
randomName
());
...
...
@@ -458,6 +459,34 @@ function testFieldSqlStorageForeignKeys() {
$this
->
assertEqual
(
$foreign_key
[
'columns'
][
$foreign_key_column
],
'id'
,
'Foreign key column name preserved in the schema'
);
}
/**
* Tests reacting to a bundle being renamed.
*/
function
testFieldSqlStorageBundleRename
()
{
$entity_type
=
$bundle
=
'entity_test_rev'
;
// Create an entity.
$value
=
mt_rand
(
1
,
127
);
$entity
=
entity_create
(
$entity_type
,
array
(
'type'
=>
$bundle
,
$this
->
field
->
name
=>
$value
,
));
$entity
->
save
();
// Rename the bundle.
$bundle_new
=
$bundle
.
'_renamed'
;
entity_test_rename_bundle
(
$bundle
,
$bundle_new
,
$entity_type
);
// Check that the 'bundle' column has been updated in storage.
$row
=
db_select
(
$this
->
table
,
't'
)
->
fields
(
't'
,
array
(
'bundle'
,
$this
->
field
->
name
.
'_value'
))
->
condition
(
'entity_id'
,
$entity
->
id
())
->
execute
()
->
fetch
();
$this
->
assertEqual
(
$row
->
bundle
,
$bundle_new
);
$this
->
assertEqual
(
$row
->
{
$this
->
field
->
name
.
'_value'
},
$value
);
}
/**
* Tests table name generation.
*/
...
...
core/modules/system/tests/modules/entity_test/entity_test.module
View file @
e40eb197
...
...
@@ -80,7 +80,7 @@ function entity_test_entity_info_alter(&$info) {
* 'entity_test'.
*/
function
entity_test_create_bundle
(
$bundle
,
$text
=
NULL
,
$entity_type
=
'entity_test'
)
{
$bundles
=
\
Drupal
::
state
()
->
get
(
$entity_type
.
'.bundles'
)
?:
array
(
'
entity_t
est'
=>
array
(
'label'
=>
'Entity Test Bundle'
));
$bundles
=
\
Drupal
::
state
()
->
get
(
$entity_type
.
'.bundles'
)
?:
array
(
$
entity_t
ype
=>
array
(
'label'
=>
'Entity Test Bundle'
));
$bundles
+=
array
(
$bundle
=>
array
(
'label'
=>
$text
?
$text
:
$bundle
));
\
Drupal
::
state
()
->
set
(
$entity_type
.
'.bundles'
,
$bundles
);
...
...
@@ -99,7 +99,7 @@ function entity_test_create_bundle($bundle, $text = NULL, $entity_type = 'entity
* 'entity_test'.
*/
function
entity_test_rename_bundle
(
$bundle_old
,
$bundle_new
,
$entity_type
=
'entity_test'
)
{
$bundles
=
\
Drupal
::
state
()
->
get
(
$entity_type
.
'.bundles'
)
?:
array
(
'
entity_t
est'
=>
array
(
'label'
=>
'Entity Test Bundle'
));
$bundles
=
\
Drupal
::
state
()
->
get
(
$entity_type
.
'.bundles'
)
?:
array
(
$
entity_t
ype
=>
array
(
'label'
=>
'Entity Test Bundle'
));
$bundles
[
$bundle_new
]
=
$bundles
[
$bundle_old
];
unset
(
$bundles
[
$bundle_old
]);
\
Drupal
::
state
()
->
set
(
$entity_type
.
'.bundles'
,
$bundles
);
...
...
@@ -117,7 +117,7 @@ function entity_test_rename_bundle($bundle_old, $bundle_new, $entity_type = 'ent
* 'entity_test'.
*/
function
entity_test_delete_bundle
(
$bundle
,
$entity_type
=
'entity_test'
)
{
$bundles
=
\
Drupal
::
state
()
->
get
(
$entity_type
.
'.bundles'
)
?:
array
(
'
entity_t
est'
=>
array
(
'label'
=>
'Entity Test Bundle'
));
$bundles
=
\
Drupal
::
state
()
->
get
(
$entity_type
.
'.bundles'
)
?:
array
(
$
entity_t
ype
=>
array
(
'label'
=>
'Entity Test Bundle'
));
unset
(
$bundles
[
$bundle
]);
\
Drupal
::
state
()
->
set
(
$entity_type
.
'.bundles'
,
$bundles
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment