You are here

function eck__entity_type__properties_schema in Entity Construction Kit (ECK) 7.3

Property schema.

Parameters

object $entity_type: Entity type object.

Return value

array A schema array for an entity type.

1 call to eck__entity_type__properties_schema()
eck__entity_type__schema in ./eck.entity_type.inc
Create the default schema for an entity type.

File

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

Code

function eck__entity_type__properties_schema($entity_type) {
  $schema = array();
  foreach ($entity_type->properties as $property => $property_info) {
    $property_type_class = eck_get_property_type_class($property_info['type']);
    $schema[$property] = $property_type_class::schema();
    if (array_key_exists('schema', $property_info) && !empty($property_info['schema'])) {

      // If the default was empty, then we took it off the property schema, so
      // we need to make sure we don't add it back during the merge.
      if (array_key_exists('default', $schema[$property]) && !array_key_exists('default', $property_info['schema'])) {
        unset($schema[$property]['default']);
      }
      $schema[$property] = array_merge($schema[$property], $property_info['schema']);
    }
  }
  return $schema;
}