You are here

function eck__entity_type__schema in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7 eck.entity_type.inc \eck__entity_type__schema()
  2. 7.2 eck.entity_type.inc \eck__entity_type__schema()

Create the default schema for an entity type.

Parameters

EntityType $entity_type: Entity type as returned by eck__entity_type__load().

Passthrough for hook_schema().

2 calls to eck__entity_type__schema()
eck_schema_alter in ./eck.module
Implements hook_schema_alter().
EntityType::save in ./eck.classes.inc
Save.

File

./eck.entity_type.inc, line 326
ENTITY TYPE

Code

function eck__entity_type__schema($entity_type) {
  $schema = array(
    'description' => "The base table for a(n) {$entity_type->name}.",
    'fields' => array(
      'id' => array(
        'description' => "The primary identifier for a(n) {$entity_type->name}.",
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'type' => array(
        'description' => 'The bundle of the entity',
        'type' => 'varchar',
        'default' => '',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    // Add required schema metadata fields.
    // @see _drupal_schema_initialize().
    'module' => 'eck',
    'name' => "eck_{$entity_type->name}",
  );

  // Add properties to schema definition.
  $schema['fields'] += eck__entity_type__properties_schema($entity_type);
  return $schema;
}