class YamlFormSubmissionStorage in YAML Form 8
Defines the form submission storage.
Hierarchy
- class \Drupal\Core\Entity\EntityHandlerBase uses DependencySerializationTrait, StringTranslationTrait
- class \Drupal\Core\Entity\EntityStorageBase implements EntityHandlerInterface, EntityStorageInterface
- class \Drupal\Core\Entity\ContentEntityStorageBase implements ContentEntityStorageInterface, DynamicallyFieldableEntityStorageInterface uses DeprecatedServicePropertyTrait
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorage implements EntityBundleListenerInterface, DynamicallyFieldableEntityStorageSchemaInterface, SqlEntityStorageInterface
- class \Drupal\yamlform\YamlFormSubmissionStorage implements YamlFormSubmissionStorageInterface
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorage implements EntityBundleListenerInterface, DynamicallyFieldableEntityStorageSchemaInterface, SqlEntityStorageInterface
- class \Drupal\Core\Entity\ContentEntityStorageBase implements ContentEntityStorageInterface, DynamicallyFieldableEntityStorageInterface uses DeprecatedServicePropertyTrait
- class \Drupal\Core\Entity\EntityStorageBase implements EntityHandlerInterface, EntityStorageInterface
Expanded class hierarchy of YamlFormSubmissionStorage
File
- src/
YamlFormSubmissionStorage.php, line 14
Namespace
Drupal\yamlformView source
class YamlFormSubmissionStorage extends SqlContentEntityStorage implements YamlFormSubmissionStorageInterface {
/**
* Array used to element data schema.
*
* @var array
*/
protected $elementDataSchema = [];
/**
* {@inheritdoc}
*/
public function getFieldDefinitions() {
/** @var \Drupal\Core\Field\BaseFieldDefinition[] $definitions */
$field_definitions = $this->entityManager
->getBaseFieldDefinitions('yamlform_submission');
// For now never let any see or export the serialize YAML data field.
unset($field_definitions['data']);
$definitions = [];
foreach ($field_definitions as $field_name => $field_definition) {
$definitions[$field_name] = [
'title' => $field_definition
->getLabel(),
'name' => $field_name,
'type' => $field_definition
->getType(),
'target_type' => $field_definition
->getSetting('target_type'),
];
}
return $definitions;
}
/**
* {@inheritdoc}
*/
public function loadDraft(YamlFormInterface $yamlform, EntityInterface $source_entity = NULL, AccountInterface $account = NULL) {
$query = $this
->getQuery();
$query
->condition('in_draft', TRUE);
$query
->condition('yamlform_id', $yamlform
->id());
$query
->condition('uid', $account
->id());
if ($source_entity) {
$query
->condition('entity_type', $source_entity
->getEntityTypeId());
$query
->condition('entity_id', $source_entity
->id());
}
else {
$query
->notExists('entity_type');
$query
->notExists('entity_id');
}
if ($entity_ids = $query
->execute()) {
return $this
->load(reset($entity_ids));
}
else {
return NULL;
}
}
/**
* {@inheritdoc}
*/
protected function doCreate(array $values) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $entity */
$entity = parent::doCreate($values);
if (!empty($values['data'])) {
$data = is_array($values['data']) ? $values['data'] : Yaml::decode($values['data']);
$entity
->setData($data);
}
return $entity;
}
/**
* {@inheritdoc}
*/
public function loadMultiple(array $ids = NULL) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface[] $yamlform_submissions */
$yamlform_submissions = parent::loadMultiple($ids);
$this
->loadData($yamlform_submissions);
return $yamlform_submissions;
}
/**
* {@inheritdoc}
*/
public function deleteAll(YamlFormInterface $yamlform = NULL, EntityInterface $source_entity = NULL, $limit = NULL, $max_sid = NULL) {
$query = $this
->getQuery()
->sort('sid');
if ($yamlform) {
$query
->condition('yamlform_id', $yamlform
->id());
}
if ($source_entity) {
$query
->condition('entity_type', $source_entity
->getEntityTypeId());
$query
->condition('entity_id', $source_entity
->id());
}
if ($limit) {
$query
->range(0, $limit);
}
if ($max_sid) {
$query
->condition('sid', $max_sid, '<=');
}
$entity_ids = $query
->execute();
$entities = $this
->loadMultiple($entity_ids);
$this
->delete($entities);
return count($entities);
}
/**
* {@inheritdoc}
*/
public function getTotal(YamlFormInterface $yamlform = NULL, EntityInterface $source_entity = NULL, AccountInterface $account = NULL) {
$query = $this
->getQuery();
$query
->condition('in_draft', FALSE);
if ($yamlform) {
$query
->condition('yamlform_id', $yamlform
->id());
}
if ($source_entity) {
$query
->condition('entity_type', $source_entity
->getEntityTypeId());
$query
->condition('entity_id', $source_entity
->id());
}
if ($account) {
$query
->condition('uid', $account
->id());
}
// Issue: Query count method is not working for SQL Lite.
// return $query->count()->execute();
// Work-around: Manually count the number of entity ids.
return count($query
->execute());
}
/**
* {@inheritdoc}
*/
public function getMaxSubmissionId(YamlFormInterface $yamlform = NULL, EntityInterface $source_entity = NULL, AccountInterface $account = NULL) {
$query = $this
->getQuery();
$query
->sort('sid', 'DESC');
if ($yamlform) {
$query
->condition('yamlform_id', $yamlform
->id());
}
if ($source_entity) {
$query
->condition('entity_type', $source_entity
->getEntityTypeId());
$query
->condition('entity_id', $source_entity
->id());
}
if ($account) {
$query
->condition('uid', $account
->id());
}
$query
->range(0, 1);
$result = $query
->execute();
return reset($result);
}
/****************************************************************************/
// Paging methods.
/****************************************************************************/
/**
* {@inheritdoc}
*/
public function getFirstSubmission(YamlFormInterface $yamlform, EntityInterface $source_entity = NULL, AccountInterface $account = NULL) {
return $this
->getTerminusSubmission($yamlform, $source_entity, $account, 'ASC');
}
/**
* {@inheritdoc}
*/
public function getLastSubmission(YamlFormInterface $yamlform, EntityInterface $source_entity = NULL, AccountInterface $account = NULL) {
return $this
->getTerminusSubmission($yamlform, $source_entity, $account, 'DESC');
}
/**
* {@inheritdoc}
*/
public function getPreviousSubmission(YamlFormSubmissionInterface $yamlform_submission, EntityInterface $source_entity = NULL, AccountInterface $account = NULL) {
return $this
->getSiblingSubmission($yamlform_submission, $source_entity, $account, 'previous');
}
/**
* {@inheritdoc}
*/
public function getNextSubmission(YamlFormSubmissionInterface $yamlform_submission, EntityInterface $source_entity = NULL, AccountInterface $account = NULL) {
return $this
->getSiblingSubmission($yamlform_submission, $source_entity, $account, 'next');
}
/**
* {@inheritdoc}
*/
public function getSourceEntityTypes(YamlFormInterface $yamlform) {
$entity_types = Database::getConnection()
->select('yamlform_submission', 's')
->distinct()
->fields('s', [
'entity_type',
])
->condition('s.yamlform_id', $yamlform
->id())
->condition('s.entity_type', 'yamlform', '<>')
->orderBy('s.entity_type', 'ASC')
->execute()
->fetchCol();
$entity_type_labels = \Drupal::service('entity_type.repository')
->getEntityTypeLabels();
ksort($entity_type_labels);
return array_intersect_key($entity_type_labels, array_flip($entity_types));
}
/**
* {@inheritdoc}
*/
protected function getTerminusSubmission(YamlFormInterface $yamlform, EntityInterface $source_entity = NULL, AccountInterface $account = NULL, $sort = 'DESC') {
$query = $this
->getQuery();
$query
->condition('yamlform_id', $yamlform
->id());
$query
->condition('in_draft', FALSE);
$query
->range(0, 1);
if ($source_entity) {
$query
->condition('entity_type', $source_entity
->getEntityTypeId());
$query
->condition('entity_id', $source_entity
->id());
}
if ($account) {
$query
->condition('uid', $account
->id());
}
$query
->sort('sid', $sort);
return ($entity_ids = $query
->execute()) ? $this
->load(reset($entity_ids)) : NULL;
}
/**
* {@inheritdoc}
*/
protected function getSiblingSubmission(YamlFormSubmissionInterface $yamlform_submission, EntityInterface $entity = NULL, AccountInterface $account = NULL, $direction = 'previous') {
$yamlform = $yamlform_submission
->getYamlForm();
$query = $this
->getQuery();
$query
->condition('yamlform_id', $yamlform
->id());
$query
->range(0, 1);
if ($entity) {
$query
->condition('entity_type', $entity
->getEntityTypeId());
$query
->condition('entity_id', $entity
->id());
}
if ($account) {
$query
->condition('uid', $account
->id());
}
if ($direction == 'previous') {
$query
->condition('sid', $yamlform_submission
->id(), '<');
$query
->sort('sid', 'DESC');
}
else {
$query
->condition('sid', $yamlform_submission
->id(), '>');
$query
->sort('sid', 'ASC');
}
return ($entity_ids = $query
->execute()) ? $this
->load(reset($entity_ids)) : NULL;
}
/****************************************************************************/
// YamlFormSubmissionEntityList methods.
/****************************************************************************/
/**
* {@inheritdoc}
*/
public function getCustomColumns(YamlFormInterface $yamlform = NULL, EntityInterface $source_entity = NULL, AccountInterface $account = NULL, $include_elements = TRUE) {
// Get custom columns from the form's state.
if ($source_entity) {
$source_key = $source_entity
->getEntityTypeId() . '.' . $source_entity
->id();
$custom_column_names = $yamlform
->getState("results.custom.columns.{$source_key}", []);
// If the source entity does not have custom columns, then see if we
// can use the main form as the default custom columns.
if (empty($custom_column_names) && $yamlform
->getState("results.custom.default", FALSE)) {
$custom_column_names = $yamlform
->getState('results.custom.columns', []);
}
}
else {
$custom_column_names = $yamlform
->getState('results.custom.columns', []);
}
if (empty($custom_column_names)) {
return $this
->getDefaultColumns($yamlform, $source_entity, $account, $include_elements);
}
// Get custom column with labels.
$columns = $this
->getColumns($yamlform, $source_entity, $account, $include_elements);
$custom_columns = [];
foreach ($custom_column_names as $column_name) {
if (isset($columns[$column_name])) {
$custom_columns[$column_name] = $columns[$column_name];
}
}
return $custom_columns;
}
/**
* {@inheritdoc}
*/
public function getDefaultColumns(YamlFormInterface $yamlform = NULL, EntityInterface $source_entity = NULL, AccountInterface $account = NULL, $include_elements = TRUE) {
$columns = $this
->getColumns($yamlform, $source_entity, $account, $include_elements);
// Hide certain unnecessary columns, that have default set to FALSE.
foreach ($columns as $column_name => $column) {
if (isset($column['default']) && $column['default'] === FALSE) {
unset($columns[$column_name]);
}
}
return $columns;
}
/**
* {@inheritdoc}
*/
public function getColumns(YamlFormInterface $yamlform = NULL, EntityInterface $source_entity = NULL, AccountInterface $account = NULL, $include_elements = TRUE) {
$view_any = $yamlform && $yamlform
->access('submission_view_any') ? TRUE : FALSE;
$columns = [];
// Serial number.
$columns['serial'] = [
'title' => $this
->t('#'),
];
// Submission ID.
$columns['sid'] = [
'title' => $this
->t('SID'),
];
// UUID.
$columns['uuid'] = [
'title' => $this
->t('UUID'),
'default' => FALSE,
];
// Sticky (Starred/Unstarred).
if (empty($account)) {
$columns['sticky'] = [
'title' => $this
->t('Starred'),
];
// Notes.
$columns['notes'] = [
'title' => $this
->t('Notes'),
];
}
// Created.
$columns['created'] = [
'title' => $this
->t('Created'),
];
// Completed.
$columns['completed'] = [
'title' => $this
->t('Completed'),
'default' => FALSE,
];
// Changed.
$columns['changed'] = [
'title' => $this
->t('Changed'),
'default' => FALSE,
];
// Source entity.
if ($view_any && empty($source_entity)) {
$columns['entity'] = [
'title' => $this
->t('Submitted to'),
'sort' => FALSE,
];
}
// Submitted by.
if (empty($account)) {
$columns['uid'] = [
'title' => $this
->t('User'),
];
}
// Submission language.
if ($view_any && \Drupal::moduleHandler()
->moduleExists('language')) {
$columns['langcode'] = [
'title' => $this
->t('Language'),
];
}
// Remote address.
$columns['remote_addr'] = [
'title' => $this
->t('IP address'),
];
// Form.
if (empty($yamlform) && empty($source_entity)) {
$columns['yamlform_id'] = [
'title' => $this
->t('Form'),
];
}
// Form elements.
if ($yamlform && $include_elements) {
/** @var \Drupal\yamlform\YamlFormElementManagerInterface $element_manager */
$element_manager = \Drupal::service('plugin.manager.yamlform.element');
$elements = $yamlform
->getElementsFlattenedAndHasValue();
foreach ($elements as $element) {
/** @var \Drupal\yamlform\YamlFormElementInterface $element_handler */
$element_handler = $element_manager
->createInstance($element['#type']);
$columns += $element_handler
->getTableColumn($element);
}
}
// Operations.
if (empty($account)) {
$columns['operations'] = [
'title' => $this
->t('Operations'),
'sort' => FALSE,
];
}
// Add name and format to all columns.
foreach ($columns as $name => &$column) {
$column['name'] = $name;
$column['format'] = 'value';
}
return $columns;
}
/**
* {@inheritdoc}
*/
public function getCustomSetting($name, $default, YamlFormInterface $yamlform = NULL, EntityInterface $source_entity = NULL) {
// Return the default value is form and source entity is not defined.
if (!$yamlform && !$source_entity) {
return $default;
}
$key = "results.custom.{$name}";
if (!$source_entity) {
return $yamlform
->getState($key, $default);
}
$source_key = $source_entity
->getEntityTypeId() . '.' . $source_entity
->id();
if ($yamlform
->hasState("{$key}.{$source_key}")) {
return $yamlform
->getState("{$key}.{$source_key}", $default);
}
if ($yamlform
->getState("results.custom.default", FALSE)) {
return $yamlform
->getState($key, $default);
}
else {
return $default;
}
}
/****************************************************************************/
// Invoke YamlFormElement and YamlFormHandler plugin methods.
/****************************************************************************/
/**
* {@inheritdoc}
*/
public function create(array $values = []) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $entity */
// Pre create is called via the YamlFormSubmission entity.
// @see: \Drupal\yamlform\Entity\YamlFormSubmission::preCreate
$entity = parent::create($values);
$this
->invokeYamlFormElements('postCreate', $entity);
$this
->invokeYamlFormHandlers('postCreate', $entity);
return $entity;
}
/**
* {@inheritdoc}
*/
protected function postLoad(array &$entities) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $entity */
$return = parent::postLoad($entities);
foreach ($entities as $entity) {
$this
->invokeYamlFormElements('postLoad', $entity);
$this
->invokeYamlFormHandlers('postLoad', $entity);
}
return $return;
}
/**
* {@inheritdoc}
*/
protected function doPreSave(EntityInterface $entity) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $entity */
$id = parent::doPreSave($entity);
$this
->invokeYamlFormElements('preSave', $entity);
$this
->invokeYamlFormHandlers('preSave', $entity);
return $id;
}
/**
* {@inheritdoc}
*/
protected function doSave($id, EntityInterface $entity) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $entity */
if ($entity
->getYamlForm()
->getSetting('results_disabled')) {
return YamlFormSubmissionStorageInterface::SAVED_DISABLED;
}
$is_new = $entity
->isNew();
if (!$entity
->serial()) {
$entity
->set('serial', $this
->getNextSerial($entity));
}
$result = parent::doSave($id, $entity);
// Save data.
$this
->saveData($entity, !$is_new);
// DEBUG: dsm($entity->getState());
// Log transaction.
$yamlform = $entity
->getYamlForm();
$context = [
'@id' => $entity
->id(),
'@form' => $yamlform
->label(),
'link' => $entity
->toLink(t('Edit'), 'edit-form')
->toString(),
];
switch ($entity
->getState()) {
case YamlFormSubmissionInterface::STATE_DRAFT:
\Drupal::logger('yamlform')
->notice('@form: Submission #@id draft saved.', $context);
break;
case YamlFormSubmissionInterface::STATE_UPDATED:
\Drupal::logger('yamlform')
->notice('@form: Submission #@id updated.', $context);
break;
case YamlFormSubmissionInterface::STATE_COMPLETED:
if ($result === SAVED_NEW) {
\Drupal::logger('yamlform')
->notice('@form: Submission #@id created.', $context);
}
else {
\Drupal::logger('yamlform')
->notice('@form: Submission #@id completed.', $context);
}
break;
}
return $result;
}
/**
* Returns the next serial number.
*
* @return int
* The next serial number.
*/
protected function getNextSerial(YamlFormSubmissionInterface $yamlform_submission) {
$yamlform = $yamlform_submission
->getYamlForm();
$next_serial = $yamlform
->getState('next_serial');
$max_serial = $this
->getMaxSerial($yamlform);
$serial = max($next_serial, $max_serial);
$yamlform
->setState('next_serial', $serial + 1);
return $serial;
}
/**
* {@inheritdoc}
*/
public function getMaxSerial(YamlFormInterface $yamlform) {
$query = db_select('yamlform_submission');
$query
->condition('yamlform_id', $yamlform
->id());
$query
->addExpression('MAX(serial)');
return $query
->execute()
->fetchField() + 1;
}
/**
* {@inheritdoc}
*/
protected function doPostSave(EntityInterface $entity, $update) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $entity */
parent::doPostSave($entity, $update);
$this
->invokeYamlFormElements('postSave', $entity, $update);
$this
->invokeYamlFormHandlers('postSave', $entity, $update);
}
/**
* {@inheritdoc}
*/
public function delete(array $entities) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $entity */
if (!$entities) {
// If no entities were passed, do nothing.
return;
}
foreach ($entities as $entity) {
$this
->invokeYamlFormElements('preDelete', $entity);
$this
->invokeYamlFormHandlers('preDelete', $entity);
}
$return = parent::delete($entities);
$this
->deleteData($entities);
foreach ($entities as $entity) {
$this
->invokeYamlFormElements('postDelete', $entity);
$this
->invokeYamlFormHandlers('postDelete', $entity);
}
// Log deleted.
foreach ($entities as $entity) {
\Drupal::logger('yamlform')
->notice('Deleted @form: Submission #@id.', [
'@id' => $entity
->id(),
'@form' => $entity
->getYamlForm()
->label(),
]);
}
return $return;
}
/**
* {@inheritdoc}
*/
public function invokeYamlFormHandlers($method, YamlFormSubmissionInterface $yamlform_submission, &$context1 = NULL, &$context2 = NULL) {
$yamlform = $yamlform_submission
->getYamlForm();
$yamlform
->invokeHandlers($method, $yamlform_submission, $context1, $context2);
}
/**
* {@inheritdoc}
*/
public function invokeYamlFormElements($method, YamlFormSubmissionInterface $yamlform_submission, &$context1 = NULL, &$context2 = NULL) {
$yamlform = $yamlform_submission
->getYamlForm();
$yamlform
->invokeElements($method, $yamlform_submission, $context1, $context2);
}
/****************************************************************************/
// Data handlers.
/****************************************************************************/
/**
* Save form submission data from the 'yamlform_submission_data' table.
*
* @param array $yamlform_submissions
* An array of form submissions.
*/
protected function loadData(array &$yamlform_submissions) {
// Load form submission data.
if ($sids = array_keys($yamlform_submissions)) {
$result = Database::getConnection()
->select('yamlform_submission_data', 'sd')
->fields('sd', [
'yamlform_id',
'sid',
'name',
'property',
'delta',
'value',
])
->condition('sd.sid', $sids, 'IN')
->orderBy('sd.sid', 'ASC')
->orderBy('sd.name', 'ASC')
->orderBy('sd.property', 'ASC')
->orderBy('sd.delta', 'ASC')
->execute();
$submissions_data = [];
while ($record = $result
->fetchAssoc()) {
$sid = $record['sid'];
$name = $record['name'];
$elements = $yamlform_submissions[$sid]
->getYamlForm()
->getElementsFlattenedAndHasValue();
$element = isset($elements[$name]) ? $elements[$name] : [
'#yamlform_multiple' => FALSE,
'#yamlform_composite' => FALSE,
];
if ($element['#yamlform_multiple']) {
$submissions_data[$sid][$name][$record['delta']] = $record['value'];
}
elseif ($element['#yamlform_composite']) {
$submissions_data[$sid][$name][$record['property']] = $record['value'];
}
else {
$submissions_data[$sid][$name] = $record['value'];
}
}
// Set form submission data via setData().
foreach ($submissions_data as $sid => $submission_data) {
$yamlform_submissions[$sid]
->setData($submission_data);
$yamlform_submissions[$sid]
->setOriginalData($submission_data);
}
}
}
/**
* Save form submission data to the 'yamlform_submission_data' table.
*
* @param \Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission
* A form submission.
* @param bool $delete_first
* TRUE to delete any data first. For new submissions this is not needed.
*/
protected function saveData(YamlFormSubmissionInterface $yamlform_submission, $delete_first = TRUE) {
// Get submission data rows.
$data = $yamlform_submission
->getData();
$yamlform_id = $yamlform_submission
->getYamlForm()
->id();
$sid = $yamlform_submission
->id();
$elements = $yamlform_submission
->getYamlForm()
->getElementsFlattenedAndHasValue();
$rows = [];
foreach ($data as $name => $item) {
$element = isset($elements[$name]) ? $elements[$name] : [
'#yamlform_multiple' => FALSE,
'#yamlform_composite' => FALSE,
];
if ($element['#yamlform_multiple']) {
if (is_array($item)) {
foreach ($item as $delta => $value) {
$rows[] = [
'yamlform_id' => $yamlform_id,
'sid' => $sid,
'name' => $name,
'property' => '',
'delta' => $delta,
'value' => (string) $value,
];
}
}
}
elseif ($element['#yamlform_composite']) {
if (is_array($item)) {
foreach ($item as $property => $value) {
$rows[] = [
'yamlform_id' => $yamlform_id,
'sid' => $sid,
'name' => $name,
'property' => $property,
'delta' => 0,
'value' => (string) $value,
];
}
}
}
else {
$rows[] = [
'yamlform_id' => $yamlform_id,
'sid' => $sid,
'name' => $name,
'property' => '',
'delta' => 0,
'value' => (string) $item,
];
}
}
if ($delete_first) {
// Delete existing submission data rows.
$this->database
->delete('yamlform_submission_data')
->condition('sid', $sid)
->execute();
}
// Insert new submission data rows.
$query = $this->database
->insert('yamlform_submission_data')
->fields([
'yamlform_id',
'sid',
'name',
'property',
'delta',
'value',
]);
foreach ($rows as $row) {
$query
->values($row);
}
$query
->execute();
}
/**
* Delete form submission data fromthe 'yamlform_submission_data' table.
*
* @param array $yamlform_submissions
* An array of form submissions.
*/
protected function deleteData(array $yamlform_submissions) {
Database::getConnection()
->delete('yamlform_submission_data')
->condition('sid', array_keys($yamlform_submissions), 'IN')
->execute();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentEntityStorageBase:: |
protected | property | The entity bundle key. | |
ContentEntityStorageBase:: |
protected | property | Cache backend. | |
ContentEntityStorageBase:: |
protected | property | ||
ContentEntityStorageBase:: |
protected | property | The entity field manager service. | |
ContentEntityStorageBase:: |
protected | property | The entity bundle info. | |
ContentEntityStorageBase:: |
protected | property | Stores the latest revision IDs for entities. | |
ContentEntityStorageBase:: |
protected | function | Ensures integer entity key values are valid. | |
ContentEntityStorageBase:: |
public | function |
Creates a new revision starting off from the specified entity object. Overrides TranslatableRevisionableStorageInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Constructs a new entity translation object, without permanently saving it. Overrides TranslatableStorageInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Creates an entity with sample field values. Overrides ContentEntityStorageInterface:: |
1 |
ContentEntityStorageBase:: |
public | function |
Delete a specific entity revision. Overrides EntityStorageInterface:: |
1 |
ContentEntityStorageBase:: |
protected | function |
Performs storage-specific entity deletion. Overrides EntityStorageBase:: |
1 |
ContentEntityStorageBase:: |
protected | function | Gets entities from the persistent cache backend. | |
ContentEntityStorageBase:: |
public | function |
Returns the latest revision identifier for an entity. Overrides RevisionableStorageInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Returns the latest revision affecting the specified translation. Overrides TranslatableRevisionableStorageInterface:: |
|
ContentEntityStorageBase:: |
protected | function | Returns an array of field names to skip when merging revision translations. | |
ContentEntityStorageBase:: |
protected | function | Checks whether the field values changed compared to the original entity. | |
ContentEntityStorageBase:: |
protected | function | Initializes field values. | |
ContentEntityStorageBase:: |
protected | function | Invokes a method on the Field objects within an entity. | |
ContentEntityStorageBase:: |
protected | function | Invokes the post save method on the Field objects within an entity. | |
ContentEntityStorageBase:: |
protected | function |
Invokes a hook on behalf of the entity. Overrides EntityStorageBase:: |
1 |
ContentEntityStorageBase:: |
protected | function | Invokes hook_entity_storage_load(). | |
ContentEntityStorageBase:: |
protected | function | Checks translation statuses and invoke the related hooks if needed. | |
ContentEntityStorageBase:: |
protected | function | Checks whether any entity revision is translated. | |
ContentEntityStorageBase:: |
protected | function | Checks whether any stored entity revision is translated. | |
ContentEntityStorageBase:: |
public | function |
Loads multiple entity revisions. Overrides RevisionableStorageInterface:: |
1 |
ContentEntityStorageBase:: |
public | function |
Load a specific entity revision. Overrides EntityStorageInterface:: |
1 |
ContentEntityStorageBase:: |
public | function |
Loads an unchanged entity from the database. Overrides EntityStorageBase:: |
|
ContentEntityStorageBase:: |
public | function |
Reacts to the creation of a field. Overrides FieldDefinitionListenerInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Reacts to the update of a field. Overrides FieldDefinitionListenerInterface:: |
|
ContentEntityStorageBase:: |
protected | function | Populates the affected flag for all the revision translations. | |
ContentEntityStorageBase:: |
protected | function |
Gathers entities from a 'preload' step. Overrides EntityStorageBase:: |
|
ContentEntityStorageBase:: |
public | function |
Purges a batch of field data. Overrides FieldableEntityStorageInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Resets the internal, static entity cache. Overrides EntityStorageBase:: |
1 |
ContentEntityStorageBase:: |
protected | function | Stores entities in the persistent cache backend. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
DeprecatedServicePropertyTrait:: |
public | function | Allows to access deprecated/removed properties. | |
EntityHandlerBase:: |
protected | property | The module handler to invoke hooks on. | 2 |
EntityHandlerBase:: |
protected | function | Gets the module handler. | 2 |
EntityHandlerBase:: |
public | function | Sets the module handler for this handler. | |
EntityStorageBase:: |
protected | property | Name of the entity class. | |
EntityStorageBase:: |
protected | property | Information about the entity type. | |
EntityStorageBase:: |
protected | property | Entity type ID for this storage. | |
EntityStorageBase:: |
protected | property | Name of the entity's ID field in the entity database table. | |
EntityStorageBase:: |
protected | property | The memory cache. | |
EntityStorageBase:: |
protected | property | The memory cache cache tag. | |
EntityStorageBase:: |
protected | property | Name of entity's UUID database table field, if it supports UUIDs. | 1 |
EntityStorageBase:: |
protected | property | The UUID service. | 1 |
EntityStorageBase:: |
protected | function | Builds the cache ID for the passed in entity ID. | 1 |
EntityStorageBase:: |
public | function |
Gets an aggregated query instance. Overrides EntityStorageInterface:: |
|
EntityStorageBase:: |
public | function |
Gets the entity type definition. Overrides EntityStorageInterface:: |
|
EntityStorageBase:: |
public | function |
Gets the entity type ID. Overrides EntityStorageInterface:: |
|
EntityStorageBase:: |
protected | function | Gets entities from the static cache. | |
EntityStorageBase:: |
public | function |
Gets an entity query instance. Overrides EntityStorageInterface:: |
|
EntityStorageBase:: |
public | function |
Determines if the storage contains any data. Overrides EntityStorageInterface:: |
3 |
EntityStorageBase:: |
public | function |
Loads one entity. Overrides EntityStorageInterface:: |
2 |
EntityStorageBase:: |
public | function |
Load entities by their property values. Overrides EntityStorageInterface:: |
3 |
EntityStorageBase:: |
protected | function | Stores entities in the static entity cache. | |
EntityStorageInterface:: |
constant | Load the most recent version of an entity's field data. | ||
EntityStorageInterface:: |
constant | Load the version of an entity's field data specified in the entity. | ||
SqlContentEntityStorage:: |
protected | property | The base table of the entity. | |
SqlContentEntityStorage:: |
protected | property | Active database connection. | |
SqlContentEntityStorage:: |
protected | property | The table that stores properties, if the entity has multilingual support. | |
SqlContentEntityStorage:: |
protected | property | The default language entity key. | |
SqlContentEntityStorage:: |
protected | property | The entity type manager. | |
SqlContentEntityStorage:: |
protected | property | The entity type's field storage definitions. | |
SqlContentEntityStorage:: |
protected | property |
The entity langcode key. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | property | The language manager. | |
SqlContentEntityStorage:: |
protected | property | The table that stores revision field data if the entity supports revisions. | |
SqlContentEntityStorage:: |
protected | property | Name of entity's revision database table field, if it supports revisions. | |
SqlContentEntityStorage:: |
protected | property | The table that stores revisions, if the entity supports revisions. | |
SqlContentEntityStorage:: |
protected | property | The entity type's storage schema object. | |
SqlContentEntityStorage:: |
protected | property | The mapping of field columns to SQL tables. | |
SqlContentEntityStorage:: |
protected | property | Whether this storage should use the temporary table mapping. | |
SqlContentEntityStorage:: |
protected | function |
Builds an entity query. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function | Builds the query to load the entity. | |
SqlContentEntityStorage:: |
public | function |
Determines the number of entities with values for a given field. Overrides FieldableEntityStorageInterface:: |
|
SqlContentEntityStorage:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides ContentEntityStorageBase:: |
1 |
SqlContentEntityStorage:: |
protected | function | Deletes values of fields in dedicated tables for all revisions. | |
SqlContentEntityStorage:: |
protected | function | Deletes values of fields in dedicated tables for all revisions. | |
SqlContentEntityStorage:: |
protected | function |
Deletes entity field values from the storage. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Deletes field values of an entity revision from the storage. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Performs storage-specific loading of entities. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Actually loads revision field item values from the storage. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Actually loads revision field item values from the storage. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Writes entity field values to the storage. Overrides ContentEntityStorageBase:: |
1 |
SqlContentEntityStorage:: |
public | function |
Performs final cleanup after all data of a field has been purged. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function | Gets the base table name. | |
SqlContentEntityStorage:: |
public | function | Gets a table mapping for the specified entity type and storage definitions. | |
SqlContentEntityStorage:: |
public | function | Gets the data table name. | |
SqlContentEntityStorage:: |
public | function | Gets the base field definitions for a content entity type. | |
SqlContentEntityStorage:: |
protected | function | Gets entities from the storage. | |
SqlContentEntityStorage:: |
protected | function |
Gets the name of the service for the query for this entity storage. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function | Gets the revision data table name. | |
SqlContentEntityStorage:: |
public | function | Gets the revision table name. | |
SqlContentEntityStorage:: |
protected | function | Gets the entity type's storage schema object. | |
SqlContentEntityStorage:: |
public | function |
Gets a table mapping for the entity's SQL tables. Overrides SqlEntityStorageInterface:: |
|
SqlContentEntityStorage:: |
protected | function |
Determines if this entity already exists in storage. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function | Initializes table name variables. | |
SqlContentEntityStorage:: |
protected | function | Checks whether a field column should be treated as serial. | 1 |
SqlContentEntityStorage:: |
protected | function | Loads values of fields stored in dedicated tables for a group of entities. | |
SqlContentEntityStorage:: |
protected | function | Loads values for fields stored in the shared data tables. | |
SqlContentEntityStorage:: |
protected | function |
Maps from storage records to entity objects, and attaches fields. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function | Maps from an entity object to the storage record of the field data. | |
SqlContentEntityStorage:: |
protected | function | Maps from an entity object to the storage record. | |
SqlContentEntityStorage:: |
public | function |
Reacts to a bundle being created. Overrides EntityBundleListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to a bundle being deleted. Overrides EntityBundleListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the creation of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the deletion of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the update of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the creation of the fieldable entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the update of a fieldable entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the deletion of a field. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the creation of a field storage definition. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the deletion of a field storage definition. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the update of a field storage definition. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Removes field items from storage per entity during purge. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Reads values to be purged for a single field. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Checks if existing data would be lost if the schema changes were applied. Overrides EntityStorageSchemaInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Checks if the changes to the entity type requires storage schema changes. Overrides EntityStorageSchemaInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Checks if existing data would be lost if the schema changes were applied. Overrides DynamicallyFieldableEntityStorageSchemaInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Checks if the changes to the storage definition requires schema changes. Overrides DynamicallyFieldableEntityStorageSchemaInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Restores a previously saved entity. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Saves the entity permanently. Overrides EntityStorageBase:: |
1 |
SqlContentEntityStorage:: |
protected | function | Saves an entity revision. | |
SqlContentEntityStorage:: |
protected | function | Saves values of fields that use dedicated tables. | 1 |
SqlContentEntityStorage:: |
protected | function | Saves fields that use the shared tables. | |
SqlContentEntityStorage:: |
public | function | Updates the wrapped entity type definition. | |
SqlContentEntityStorage:: |
public | function | Updates the internal list of field storage definitions. | |
SqlContentEntityStorage:: |
public | function | Sets the wrapped table mapping definition. | |
SqlContentEntityStorage:: |
public | function | Changes the temporary state of the storage. | |
SqlContentEntityStorage:: |
protected | function | Determines whether the passed field has been already deleted. | |
SqlContentEntityStorage:: |
protected | function | Wraps a database schema exception into an entity storage exception. | |
SqlContentEntityStorage:: |
public | function |
Constructs a SqlContentEntityStorage object. Overrides ContentEntityStorageBase:: |
1 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
YamlFormSubmissionStorage:: |
protected | property | Array used to element data schema. | |
YamlFormSubmissionStorage:: |
public | function |
Constructs a new entity object, without permanently saving it. Overrides EntityStorageBase:: |
|
YamlFormSubmissionStorage:: |
public | function |
Deletes permanently saved entities. Overrides SqlContentEntityStorage:: |
|
YamlFormSubmissionStorage:: |
public | function |
Delete all form submissions. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
protected | function | Delete form submission data fromthe 'yamlform_submission_data' table. | |
YamlFormSubmissionStorage:: |
protected | function |
Performs storage-specific creation of entities. Overrides ContentEntityStorageBase:: |
|
YamlFormSubmissionStorage:: |
protected | function |
Performs post save entity processing. Overrides ContentEntityStorageBase:: |
|
YamlFormSubmissionStorage:: |
protected | function |
Performs presave entity processing. Overrides ContentEntityStorageBase:: |
|
YamlFormSubmissionStorage:: |
protected | function |
Performs storage-specific saving of the entity. Overrides ContentEntityStorageBase:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get submission columns used to display results table. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get customized submission columns used to display custom table. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get customize setting. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get default submission columns used to display results. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get form submission entity field definitions. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get a form's first submission. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get a form's last submission. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Returns a form's max serial number. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get the maximum sid. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
protected | function | Returns the next serial number. | |
YamlFormSubmissionStorage:: |
public | function |
Get a form submission's next sibling. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Get a form submission's previous sibling. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
protected | function | ||
YamlFormSubmissionStorage:: |
public | function |
Get form submission source entity types. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
protected | function | ||
YamlFormSubmissionStorage:: |
public | function |
Get the total number of submissions. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Invoke a form submission's form's elements method. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Invoke a form submission's form's handlers method. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
protected | function | Save form submission data from the 'yamlform_submission_data' table. | |
YamlFormSubmissionStorage:: |
public | function |
Get form submission draft. Overrides YamlFormSubmissionStorageInterface:: |
|
YamlFormSubmissionStorage:: |
public | function |
Loads one or more entities. Overrides EntityStorageBase:: |
|
YamlFormSubmissionStorage:: |
protected | function |
Attaches data to entities upon loading. Overrides EntityStorageBase:: |
|
YamlFormSubmissionStorage:: |
protected | function | Save form submission data to the 'yamlform_submission_data' table. | |
YamlFormSubmissionStorageInterface:: |
constant | Return status for saving of YAML forb submission when saving results is disabled. |