comparison core/modules/aggregator/src/ItemStorageSchema.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\aggregator;
4
5 use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
6 use Drupal\Core\Field\FieldStorageDefinitionInterface;
7
8 /**
9 * Defines the item schema handler.
10 */
11 class ItemStorageSchema extends SqlContentEntityStorageSchema {
12
13 /**
14 * {@inheritdoc}
15 */
16 protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) {
17 $schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping);
18 $field_name = $storage_definition->getName();
19
20 if ($table_name == 'aggregator_item') {
21 switch ($field_name) {
22 case 'timestamp':
23 $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE);
24 break;
25
26 case 'fid':
27 $this->addSharedTableFieldForeignKey($storage_definition, $schema, 'aggregator_feed', 'fid');
28 break;
29 }
30 }
31
32 return $schema;
33 }
34
35 }