Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
d5a4cb43
Commit
d5a4cb43
authored
Apr 22, 2013
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1976068
by chx: Remove schema_fields_sql() from entity plugin definition.
parent
ea4dcb41
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
28 deletions
+7
-28
core/lib/Drupal/Core/Entity/DatabaseStorageController.php
core/lib/Drupal/Core/Entity/DatabaseStorageController.php
+2
-2
core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
+4
-4
core/lib/Drupal/Core/Entity/EntityManager.php
core/lib/Drupal/Core/Entity/EntityManager.php
+0
-21
core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
...rence/Plugin/entity_reference/selection/SelectionBase.php
+1
-1
No files found.
core/lib/Drupal/Core/Entity/DatabaseStorageController.php
View file @
d5a4cb43
...
...
@@ -344,11 +344,11 @@ protected function buildQuery($ids, $revision_id = FALSE) {
}
// Add fields from the {entity} table.
$entity_fields
=
$this
->
entityInfo
[
'schema_fields_sql'
]
[
'base_table'
];
$entity_fields
=
drupal_schema_fields_sql
(
$this
->
entityInfo
[
'base_table'
]
)
;
if
(
$this
->
revisionKey
)
{
// Add all fields from the {entity_revision} table.
$entity_revision_fields
=
drupal_map_assoc
(
$this
->
entityInfo
[
'schema_fields_sql'
]
[
'revision_table'
]);
$entity_revision_fields
=
drupal_map_assoc
(
drupal_schema_fields_sql
(
$this
->
entityInfo
[
'revision_table'
])
)
;
// The id field is provided by entity, so remove it.
unset
(
$entity_revision_fields
[
$this
->
idKey
]);
...
...
core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
View file @
d5a4cb43
...
...
@@ -241,7 +241,7 @@ protected function attachPropertyData(array &$entities, $load_revision = FALSE)
// Fetch the field definitions to check which field is translatable.
$field_definition
=
$this
->
getFieldDefinitions
(
array
());
$data_fields
=
array_flip
(
$this
->
entityInfo
[
'schema_fields_sql'
]
[
'data_table'
]);
$data_fields
=
array_flip
(
drupal_schema_fields_sql
(
$this
->
entityInfo
[
'data_table'
])
)
;
foreach
(
$data
as
$values
)
{
$id
=
$values
[
$this
->
idKey
];
...
...
@@ -439,7 +439,7 @@ protected function invokeHook($hook, EntityInterface $entity) {
*/
protected
function
mapToStorageRecord
(
EntityInterface
$entity
)
{
$record
=
new
\
stdClass
();
foreach
(
$this
->
entityInfo
[
'schema_fields_sql'
]
[
'base_table'
]
as
$name
)
{
foreach
(
drupal_schema_fields_sql
(
$this
->
entityInfo
[
'base_table'
]
)
as
$name
)
{
$record
->
$name
=
$entity
->
$name
->
value
;
}
return
$record
;
...
...
@@ -456,7 +456,7 @@ protected function mapToStorageRecord(EntityInterface $entity) {
*/
protected
function
mapToRevisionStorageRecord
(
EntityInterface
$entity
)
{
$record
=
new
\
stdClass
();
foreach
(
$this
->
entityInfo
[
'schema_fields_sql'
]
[
'revision_table'
]
as
$name
)
{
foreach
(
drupal_schema_fields_sql
(
$this
->
entityInfo
[
'revision_table'
]
)
as
$name
)
{
if
(
isset
(
$entity
->
$name
->
value
))
{
$record
->
$name
=
$entity
->
$name
->
value
;
}
...
...
@@ -482,7 +482,7 @@ protected function mapToDataStorageRecord(EntityInterface $entity, $langcode) {
$translation
=
$entity
->
getTranslation
(
$langcode
,
FALSE
);
$record
=
new
\
stdClass
();
foreach
(
$this
->
entityInfo
[
'schema_fields_sql'
]
[
'data_table'
]
as
$name
)
{
foreach
(
drupal_schema_fields_sql
(
$this
->
entityInfo
[
'data_table'
]
)
as
$name
)
{
$record
->
$name
=
$translation
->
$name
->
value
;
}
$record
->
langcode
=
$langcode
;
...
...
core/lib/Drupal/Core/Entity/EntityManager.php
View file @
d5a4cb43
...
...
@@ -9,7 +9,6 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\Component\Plugin\Discovery\ProcessDecorator
;
use
Drupal\Core\Plugin\Discovery\AlterDecorator
;
use
Drupal\Core\Plugin\Discovery\CacheDecorator
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
...
...
@@ -52,32 +51,12 @@ public function __construct(array $namespaces) {
);
$this
->
discovery
=
new
AnnotatedClassDiscovery
(
'Core'
,
'Entity'
,
$namespaces
,
$annotation_namespaces
,
'Drupal\Core\Entity\Annotation\EntityType'
);
$this
->
discovery
=
new
InfoHookDecorator
(
$this
->
discovery
,
'entity_info'
);
$this
->
discovery
=
new
ProcessDecorator
(
$this
->
discovery
,
array
(
$this
,
'processDefinition'
));
$this
->
discovery
=
new
AlterDecorator
(
$this
->
discovery
,
'entity_info'
);
$this
->
discovery
=
new
CacheDecorator
(
$this
->
discovery
,
'entity_info:'
.
language
(
LANGUAGE_TYPE_INTERFACE
)
->
langcode
,
'cache'
,
CacheBackendInterface
::
CACHE_PERMANENT
,
array
(
'entity_info'
=>
TRUE
));
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
/**
* Overrides Drupal\Component\Plugin\PluginManagerBase::processDefinition().
*/
public
function
processDefinition
(
&
$definition
,
$plugin_id
)
{
parent
::
processDefinition
(
$definition
,
$plugin_id
);
// Prepare entity schema fields SQL info for
// Drupal\Core\Entity\DatabaseStorageControllerInterface::buildQuery().
if
(
isset
(
$definition
[
'base_table'
]))
{
$definition
[
'schema_fields_sql'
][
'base_table'
]
=
drupal_schema_fields_sql
(
$definition
[
'base_table'
]);
if
(
isset
(
$definition
[
'data_table'
]))
{
$definition
[
'schema_fields_sql'
][
'data_table'
]
=
drupal_schema_fields_sql
(
$definition
[
'data_table'
]);
}
if
(
isset
(
$definition
[
'revision_table'
]))
{
$definition
[
'schema_fields_sql'
][
'revision_table'
]
=
drupal_schema_fields_sql
(
$definition
[
'revision_table'
]);
}
}
}
/**
* Checks whether a certain entity type has a certain controller.
*
...
...
core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
View file @
d5a4cb43
...
...
@@ -113,7 +113,7 @@ public static function settingsForm(&$field, &$instance) {
// @todo Use Entity::getPropertyDefinitions() when all entity types are
// converted to the new Field API.
$fields
=
drupal_map_assoc
(
$entity_info
[
'
schema_fields_sql
'
]
[
'base_table'
]);
$fields
=
drupal_map_assoc
(
drupal_
schema_fields_sql
(
$entity_info
[
'base_table'
])
)
;
foreach
(
field_info_instances
(
$field
[
'settings'
][
'target_type'
])
as
$bundle_instances
)
{
foreach
(
$bundle_instances
as
$instance_name
=>
$instance_info
)
{
$field_info
=
field_info_field
(
$instance_name
);
...
...
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