Drupal 8  8.0.2
ConfigEntityStorage Class Reference
Inheritance diagram for ConfigEntityStorage:

Public Member Functions

 __construct (EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager)
 
 loadRevision ($revision_id)
 
 deleteRevision ($revision_id)
 
 save (EntityInterface $entity)
 
 importCreate ($name, Config $new_config, Config $old_config)
 
 importUpdate ($name, Config $new_config, Config $old_config)
 
 importDelete ($name, Config $new_config, Config $old_config)
 
 importRename ($old_name, Config $new_config, Config $old_config)
 
 createFromStorageRecord (array $values)
 
 updateFromStorageRecord (ConfigEntityInterface $entity, array $values)
 
 loadOverrideFree ($id)
 
 loadMultipleOverrideFree (array $ids=NULL)
 
- Public Member Functions inherited from EntityStorageBase
 __construct (EntityTypeInterface $entity_type)
 
 getEntityTypeId ()
 
 getEntityType ()
 
 loadUnchanged ($id)
 
 resetCache (array $ids=NULL)
 
 create (array $values=array())
 
 load ($id)
 
 loadMultiple (array $ids=NULL)
 
 delete (array $entities)
 
 save (EntityInterface $entity)
 
 loadByProperties (array $values=array())
 
 getQuery ($conjunction= 'AND')
 
 getAggregateQuery ($conjunction= 'AND')
 
- Public Member Functions inherited from EntityHandlerBase
 setModuleHandler (ModuleHandlerInterface $module_handler)
 

Static Public Member Functions

static createInstance (ContainerInterface $container, EntityTypeInterface $entity_type)
 
static getIDFromConfigName ($config_name, $config_prefix)
 

Data Fields

const MAX_ID_LENGTH = 166
 
- Data Fields inherited from EntityStorageInterface
const FIELD_LOAD_CURRENT = 'FIELD_LOAD_CURRENT'
 
const FIELD_LOAD_REVISION = 'FIELD_LOAD_REVISION'
 

Protected Member Functions

 getPrefix ()
 
 doCreate (array $values)
 
 doDelete ($entities)
 
 doSave ($id, EntityInterface $entity)
 
 mapToStorageRecord (EntityInterface $entity)
 
 has ($id, EntityInterface $entity)
 
 getFromStaticCache (array $ids)
 
 setStaticCache (array $entities)
 
 invokeHook ($hook, EntityInterface $entity)
 
 getQueryServiceName ()
 
- Protected Member Functions inherited from EntityStorageBase
 getFromStaticCache (array $ids)
 
 setStaticCache (array $entities)
 
 invokeHook ($hook, EntityInterface $entity)
 
 doCreate (array $values)
 
 doLoadMultiple (array $ids=NULL)
 
 postLoad (array &$entities)
 
 mapFromStorageRecords (array $records)
 
 has ($id, EntityInterface $entity)
 
 doDelete ($entities)
 
 doPreSave (EntityInterface $entity)
 
 doSave ($id, EntityInterface $entity)
 
 doPostSave (EntityInterface $entity, $update)
 
 buildPropertyQuery (QueryInterface $entity_query, array $values)
 
 getQueryServiceName ()
 
- Protected Member Functions inherited from EntityHandlerBase
 moduleHandler ()
 

Protected Attributes

 $uuidKey = 'uuid'
 
 $configFactory
 
 $configStorage
 
 $languageManager
 
 $entities = array()
 
 $overrideFree = FALSE
 
- Protected Attributes inherited from EntityStorageBase
 $entities = array()
 
 $entityTypeId
 
 $entityType
 
 $idKey
 
 $uuidKey
 
 $langcodeKey
 
 $uuidService
 
 $entityClass
 
- Protected Attributes inherited from EntityHandlerBase
 $moduleHandler
 

Detailed Description

Defines the storage class for configuration entities.

Configuration object names of configuration entities are comprised of two parts, separated by a dot:

  • config_prefix: A string denoting the owner (module/extension) of the configuration object, followed by arbitrary other namespace identifiers that are declared by the owning extension; e.g., 'node.type'. The config_prefix does NOT contain a trailing dot. It is defined by the entity type's annotation.
  • ID: A string denoting the entity ID within the entity type namespace; e.g., 'article'. Entity IDs may contain dots/periods. The entire remaining string after the config_prefix in a config name forms the entity ID. Additional or custom suffixes are not possible.

Constructor & Destructor Documentation

__construct ( EntityTypeInterface  $entity_type,
ConfigFactoryInterface  $config_factory,
UuidInterface  $uuid_service,
LanguageManagerInterface  $language_manager 
)

Constructs a ConfigEntityStorage object.

Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition.
\Drupal\Core\Config\ConfigFactoryInterface$config_factoryThe config factory service.
\Drupal\Component\Uuid\UuidInterface$uuid_serviceThe UUID service.
\Drupal\Core\Language\LanguageManagerInterface$language_managerThe language manager.

References Drupal\configFactory(), and Drupal\languageManager().

Here is the call graph for this function:

Member Function Documentation

createFromStorageRecord ( array  $values)

{Creates a configuration entity from storage values.Allows the configuration entity storage to massage storage values before creating an entity.

Parameters
array$valuesThe array of values from the configuration storage.
Returns
ConfigEntityInterface The configuration entity.
See Also
::mapFromStorageRecords()
::mapFromStorageRecords()
}

Implements ConfigEntityStorageInterface.

References ConfigEntityStorage\$uuidKey, ConfigEntityStorage\invokeHook(), and EntityStorageBase\mapFromStorageRecords().

Referenced by ConfigEntityStorage\importCreate().

Here is the call graph for this function:

Here is the caller graph for this function:

static createInstance ( ContainerInterface  $container,
EntityTypeInterface  $entity_type 
)
static

{Instantiates a new instance of this entity handler.This is a factory method that returns a new instance of this object. The factory should pass any needed dependencies into the constructor of this object, but not the container itself. Every call to this method must return a new instance of this object; that is, it may not implement a singleton.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe service container this object should use.
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition.
Returns
static A new instance of the entity handler.
}

Implements EntityHandlerInterface.

References EntityTypeInterface\get().

Here is the call graph for this function:

deleteRevision (   $revision_id)

{Delete a specific entity revision.A revision can only be deleted if it's not the currently active one.

Parameters
int$revision_idThe revision id.
}

Implements EntityStorageInterface.

doCreate ( array  $values)
protected

{}

References Drupal\languageManager().

Here is the call graph for this function:

doDelete (   $entities)
protected

{}

References Drupal\configFactory(), and ConfigEntityStorage\getPrefix().

Here is the call graph for this function:

doSave (   $id,
EntityInterface  $entity 
)
protected

{}

References Drupal\configFactory(), ConfigEntityStorage\getPrefix(), EntityInterface\id(), EntityInterface\isNew(), EntityStorageBase\mapFromStorageRecords(), and ConfigEntityStorage\mapToStorageRecord().

Here is the call graph for this function:

getFromStaticCache ( array  $ids)
protected

Gets entities from the static cache.

Parameters
array$idsIf not empty, return entities that match these IDs.
Returns
[] Array of entities from the entity cache.

References Drupal\configFactory().

Here is the call graph for this function:

static getIDFromConfigName (   $config_name,
  $config_prefix 
)
static

{Extracts the configuration entity ID from the full configuration name.

Parameters
string$config_nameThe full configuration name to extract the ID from; for example, 'views.view.archive'.
string$config_prefixThe config prefix of the configuration entity; for example, 'views.view'.
Returns
string The ID of the configuration entity.
}

Implements ConfigEntityStorageInterface.

Referenced by BundleConfigImportValidate\onConfigImporterValidate().

Here is the caller graph for this function:

getPrefix ( )
protected

Returns the prefix used to create the configuration name.

The prefix consists of the config prefix from the entity type plus a dot for separating from the ID.

Returns
string The full configuration prefix, for example 'views.view.'.

Referenced by ConfigEntityStorage\doDelete(), ConfigEntityStorage\doSave(), and ConfigEntityStorage\has().

Here is the caller graph for this function:

getQueryServiceName ( )
protected

{}

has (   $id,
EntityInterface  $entity 
)
protected

{}

References Drupal\configFactory(), and ConfigEntityStorage\getPrefix().

Here is the call graph for this function:

importCreate (   $name,
Config  $new_config,
Config  $old_config 
)

{Creates entities upon synchronizing configuration changes.

Parameters
string$nameThe name of the configuration object.
\Drupal\Core\Config\Config$new_configA configuration object containing the new configuration data.
\Drupal\Core\Config\Config$old_configA configuration object containing the old configuration data.
}

Implements ImportableEntityStorageInterface.

References ConfigEntityStorage\createFromStorageRecord(), and Config\get().

Here is the call graph for this function:

importDelete (   $name,
Config  $new_config,
Config  $old_config 
)

{Delete entities upon synchronizing configuration changes.

Parameters
string$nameThe name of the configuration object.
\Drupal\Core\Config\Config$new_configA configuration object containing the new configuration data.
\Drupal\Core\Config\Config$old_configA configuration object containing the old configuration data.
}

Implements ImportableEntityStorageInterface.

References EntityStorageBase\load().

Here is the call graph for this function:

importRename (   $old_name,
Config  $new_config,
Config  $old_config 
)

{Renames entities upon synchronizing configuration changes.

Parameters
string$old_nameThe original name of the configuration object.
\Drupal\Core\Config\Config$new_configA configuration object containing the new configuration data.
\Drupal\Core\Config\Config$old_configA configuration object containing the old configuration data.
}

Implements ImportableEntityStorageInterface.

References ConfigEntityStorage\importUpdate().

Here is the call graph for this function:

importUpdate (   $name,
Config  $new_config,
Config  $old_config 
)

{Updates entities upon synchronizing configuration changes.

Parameters
string$nameThe name of the configuration object.
\Drupal\Core\Config\Config$new_configA configuration object containing the new configuration data.
\Drupal\Core\Config\Config$old_configA configuration object containing the old configuration data.
Exceptions
\Drupal\Core\Config\ConfigImporterExceptionThrown when the config entity that should be updated can not be found.
}

Implements ImportableEntityStorageInterface.

References Config\get(), EntityStorageBase\load(), and ConfigEntityStorage\updateFromStorageRecord().

Referenced by ConfigEntityStorage\importRename().

Here is the call graph for this function:

Here is the caller graph for this function:

invokeHook (   $hook,
EntityInterface  $entity 
)
protected

Invokes a hook on behalf of the entity.

Parameters
$hookOne of 'presave', 'insert', 'update', 'predelete', or 'delete'.
$entityThe entity object.

References EntityHandlerBase\moduleHandler().

Referenced by ConfigEntityStorage\createFromStorageRecord().

Here is the call graph for this function:

Here is the caller graph for this function:

loadMultipleOverrideFree ( array  $ids = NULL)

{Loads one or more entities in their original form without overrides.

Parameters
$idsAn array of entity IDs, or NULL to load all entities.
Returns
[] An array of entity objects indexed by their IDs. Returns an empty array if no matching entities are found.
}

Implements ConfigEntityStorageInterface.

References EntityStorageBase\loadMultiple().

Referenced by ConfigEntityStorage\loadOverrideFree().

Here is the call graph for this function:

Here is the caller graph for this function:

loadOverrideFree (   $id)

{Loads one entity in their original form without overrides.

Parameters
mixed$idThe ID of the entity to load.
Returns
|null An entity object. NULL if no matching entity is found.
}

Implements ConfigEntityStorageInterface.

References ConfigEntityStorage\loadMultipleOverrideFree().

Here is the call graph for this function:

loadRevision (   $revision_id)

{Load a specific entity revision.

Parameters
int | string$revision_idThe revision id.
Returns
|null The specified entity revision or NULL if not found.
}

Implements EntityStorageInterface.

mapToStorageRecord ( EntityInterface  $entity)
protected

Maps from an entity object to the storage record.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity object.
Returns
array The record to store.

References EntityInterface\toArray().

Referenced by ConfigEntityStorage\doSave().

Here is the call graph for this function:

Here is the caller graph for this function:

save ( EntityInterface  $entity)

Implements Drupal::save().

Exceptions
EntityMalformedExceptionWhen attempting to save a configuration entity that has no ID.

Implements EntityStorageInterface.

References EntityInterface\id().

Here is the call graph for this function:

setStaticCache ( array  $entities)
protected

Stores entities in the static entity cache.

Parameters
\Drupal\Core\Entity\EntityInterface[]$entities Entities to store in the cache.

References Drupal\configFactory().

Here is the call graph for this function:

updateFromStorageRecord ( ConfigEntityInterface  $entity,
array  $values 
)

{Updates a configuration entity from storage values.Allows the configuration entity storage to massage storage values before updating an entity.

Parameters
ConfigEntityInterface$entityThe configuration entity to update.
array$valuesThe array of values from the configuration storage.
Returns
ConfigEntityInterface The configuration entity.
See Also
::mapFromStorageRecords()
::mapFromStorageRecords()
}

Implements ConfigEntityStorageInterface.

References EntityStorageBase\mapFromStorageRecords().

Referenced by ConfigEntityStorage\importUpdate().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

$uuidKey = 'uuid'
protected
const MAX_ID_LENGTH = 166

Length limit of the configuration entity ID.

Most file systems limit a file name's length to 255 characters, so ConfigBase::MAX_NAME_LENGTH restricts the full configuration object name to 250 characters (leaving 5 for the file extension). The config prefix is limited by ConfigEntityType::PREFIX_LENGTH to 83 characters, so this leaves 166 remaining characters for the configuration entity ID, with 1 additional character needed for the joining dot.

See Also
::MAX_NAME_LENGTH
::PREFIX_LENGTH

The documentation for this class was generated from the following file: