public BaseFieldDefinition::getSchema()
Returns the field schema.
Note that this method returns an empty array for computed fields which have no schema.
array[] The field schema, as an array of key/value pairs in the format returned by hook_field_schema():
Overrides FieldStorageDefinitionInterface::getSchema
public function getSchema() { if (!isset($this->schema)) { // Get the schema from the field item class. $definition = \Drupal::service('plugin.manager.field.field_type')->getDefinition($this->getType()); $class = $definition['class']; $schema = $class::schema($this); // Fill in default values. $schema += array( 'columns' => array(), 'unique keys' => array(), 'indexes' => array(), 'foreign keys' => array(), ); // Merge custom indexes with those specified by the field type. Custom // indexes prevail. $schema['indexes'] = $this->indexes + $schema['indexes']; $this->schema = $schema; } return $this->schema; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!BaseFieldDefinition.php/function/BaseFieldDefinition::getSchema/8.1.x