class SmsMessage in SMS Framework 8
Same name in this branch
- 8 src/Message/SmsMessage.php \Drupal\sms\Message\SmsMessage
- 8 src/Entity/SmsMessage.php \Drupal\sms\Entity\SmsMessage
Same name and namespace in other branches
- 2.x src/Entity/SmsMessage.php \Drupal\sms\Entity\SmsMessage
- 2.1.x src/Entity/SmsMessage.php \Drupal\sms\Entity\SmsMessage
Defines the SMS message entity.
The SMS message entity is used to maintain the message while it is queued to send to the gateway. After the message has been sent, the message may persist in the database as an archive record.
Plugin annotation
@ContentEntityType(
id = "sms",
label = @Translation("SMS Message"),
label_collection = @Translation("SMS Messages"),
label_singular = @Translation("SMS message"),
label_plural = @Translation("SMS messages"),
label_count = @PluralTranslation(
singular = "@count SMS message",
plural = "@count SMS messages",
),
base_table = "sms",
entity_keys = {
"id" = "id",
"uuid" = "uuid",
},
handlers = {
"views_data" = "Drupal\sms\Views\SmsMessageViewsData",
},
)
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements EntityInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, ContentEntityInterface, TranslationStatusInterface uses EntityChangesDetectionTrait, SynchronizableEntityTrait
- class \Drupal\sms\Entity\SmsMessage implements SmsMessageInterface
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, ContentEntityInterface, TranslationStatusInterface uses EntityChangesDetectionTrait, SynchronizableEntityTrait
Expanded class hierarchy of SmsMessage
20 files declare their use of SmsMessage
- AccountRegistration.php in modules/
sms_user/ src/ AccountRegistration.php - DefaultSmsProvider.php in src/
Provider/ DefaultSmsProvider.php - PhoneNumberProvider.php in src/
Provider/ PhoneNumberProvider.php - SendToPhoneForm.php in modules/
sms_sendtophone/ src/ Form/ SendToPhoneForm.php - SmsDevelMessageForm.php in modules/
sms_devel/ src/ Form/ SmsDevelMessageForm.php
File
- src/
Entity/ SmsMessage.php, line 43
Namespace
Drupal\sms\EntityView source
class SmsMessage extends ContentEntityBase implements SmsMessageInterface {
/**
* Temporarily stores the message result until save().
*
* @var \Drupal\sms\Message\SmsMessageResultInterface|null
*/
protected $result = NULL;
/**
* Following are implementors of plain SmsMessage interface.
*
* @see \Drupal\sms\Entity\SmsMessageInterface
*/
/**
* {@inheritdoc}
*/
public function getRecipients() {
$recipients = [];
foreach ($this
->get('recipient_phone_number') as $recipient) {
$recipients[] = $recipient->value;
}
return $recipients;
}
/**
* {@inheritdoc}
*/
public function addRecipient($recipient) {
// Ensure duplicate recipients cannot be added.
foreach ($this->recipient_phone_number as $item) {
if ($item->value == $recipient) {
return $this;
}
}
$this->recipient_phone_number
->appendItem($recipient);
return $this;
}
/**
* {@inheritdoc}
*/
public function addRecipients(array $recipients) {
foreach ($recipients as $recipient) {
$this
->addRecipient($recipient);
}
return $this;
}
/**
* {@inheritdoc}
*/
public function removeRecipient($recipient) {
$this->recipient_phone_number
->filter(function ($item) use ($recipient) {
return $item->value != $recipient;
});
return $this;
}
/**
* {@inheritdoc}
*/
public function removeRecipients(array $recipients) {
$this->recipient_phone_number
->filter(function ($item) use ($recipients) {
return !in_array($item->value, $recipients);
});
return $this;
}
/**
* {@inheritdoc}
*/
public function getOptions() {
return ($first = $this
->get('options')
->first()) ? $first
->getValue() : [];
}
/**
* {@inheritdoc}
*/
public function getOption($name) {
$options = $this
->getOptions();
return isset($options[$name]) ? $options[$name] : NULL;
}
/**
* {@inheritdoc}
*/
public function setOption($name, $value) {
$options = $this
->getOptions();
$options[$name] = $value;
$this
->set('options', $options);
return $this;
}
/**
* {@inheritdoc}
*/
public function removeOption($name) {
$options = $this
->getOptions();
unset($options[$name]);
$this
->set('options', $options);
return $this;
}
/**
* {@inheritdoc}
*/
public function getResult() {
// Check the temporary store first as that contains the most recent value.
// Also, if the entity is new then return that value (can be null).
if ($this->result || $this
->isNew()) {
return $this->result;
}
$results = $this
->entityTypeManager()
->getStorage('sms_result')
->loadByProperties([
'sms_message' => $this
->id(),
]);
return $results ? reset($results) : NULL;
}
/**
* Sets the result associated with this SMS message.
*
* Results on a saved SMS message are immutable and cannot be changed. An
* exception will be thrown if this method is called on an SmsMessage that
* already has saved results.
*
* @param \Drupal\sms\Message\SmsMessageResultInterface|null $result
* The result to associate with this SMS message, or NULL if there is no
* result.
*
* @return $this
* The called SMS message object.
*
* @throws \Drupal\sms\Exception\SmsStorageException
* If the SMS message entity already has saved results.
*/
public function setResult(StdMessageResultInterface $result = NULL) {
// Throw an exception if there is already a result for this SMS message.
$previous_result = $this
->getResult();
if ($previous_result) {
throw new SmsStorageException('Saved SMS message results cannot be changed or updated.');
}
elseif ($result) {
// Temporarily store the result so it can be retrieved without having to
// save the message entity.
$this->result = $result;
}
return $this;
}
/**
* {@inheritdoc}
*/
public function getReport($recipient) {
// If a result has been set, check that first.
if ($this->result) {
return $this->result
->getReport($recipient);
}
elseif (!$this
->isNew()) {
$reports = $this
->entityTypeManager()
->getStorage('sms_report')
->loadByProperties([
'sms_message' => $this
->id(),
'recipient' => $recipient,
]);
return $reports ? reset($reports) : NULL;
}
return NULL;
}
/**
* {@inheritdoc}
*/
public function getReports() {
// If a result has been set, check that first.
if ($this->result) {
return $this->result
->getReports();
}
elseif (!$this
->isNew()) {
return array_values($this
->entityTypeManager()
->getStorage('sms_report')
->loadByProperties([
'sms_message' => $this
->id(),
]));
}
return [];
}
/**
* {@inheritdoc}
*/
public function getSender() {
$sender_name = $this
->get('sender_name');
if (isset($sender_name->value)) {
return $sender_name->value;
}
else {
return ($sender_entity = $this
->getSenderEntity()) ? $sender_entity
->label() : NULL;
}
}
/**
* {@inheritdoc}
*
* @param string|null $sender
* The name of the sender. Or NULL to defer to the label of the sender
* entity.
*
* @see ::getSender()
*/
public function setSender($sender) {
$this
->set('sender_name', $sender);
return $this;
}
/**
* {@inheritdoc}
*/
public function getMessage() {
return $this
->get('message')->value;
}
/**
* {@inheritdoc}
*/
public function setMessage($message) {
$this
->set('message', $message);
return $this;
}
/**
* {@inheritdoc}
*/
public function getUuid() {
return $this
->get('uuid')->value;
}
/**
* {@inheritdoc}
*/
public function getUid() {
$sender = $this
->getSenderEntity();
return $sender instanceof UserInterface ? $sender
->id() : NULL;
}
/**
* {@inheritdoc}
*/
public function setUid($uid) {
$this
->setSenderEntity(User::load($uid));
return $this;
}
/**
* {@inheritdoc}
*/
public function isAutomated() {
return $this
->get('automated')->value;
}
/**
* {@inheritdoc}
*/
public function setAutomated($automated) {
$this
->set('automated', $automated);
return $this;
}
/**
* Following are implementors of entity interface.
*
* @see \Drupal\sms\Entity\SmsMessageInterface
*/
/**
* {@inheritdoc}
*/
public function getDirection() {
return $this
->get('direction')->value;
}
/**
* {@inheritdoc}
*/
public function setDirection($direction) {
$this
->set('direction', $direction);
return $this;
}
/**
* {@inheritdoc}
*/
public function getGateway() {
return $this
->get('gateway')->entity;
}
/**
* {@inheritdoc}
*/
public function setGateway(SmsGatewayInterface $gateway) {
$this
->set('gateway', $gateway);
return $this;
}
/**
* {@inheritdoc}
*/
public function getSenderNumber() {
return $this
->get('sender_phone_number')->value;
}
/**
* {@inheritdoc}
*/
public function setSenderNumber($number) {
$this
->set('sender_phone_number', $number);
return $this;
}
/**
* {@inheritdoc}
*/
public function getSenderEntity() {
return $this
->get('sender_entity')->entity;
}
/**
* {@inheritdoc}
*/
public function setSenderEntity(EntityInterface $entity) {
$this
->set('sender_entity', $entity);
return $this;
}
/**
* {@inheritdoc}
*/
public function getRecipientEntity() {
return $this
->get('recipient_entity')->entity;
}
/**
* {@inheritdoc}
*/
public function setRecipientEntity(EntityInterface $entity) {
$this
->set('recipient_entity', $entity);
return $this;
}
/**
* {@inheritdoc}
*/
public function isQueued() {
return (bool) $this
->get('queued')->value;
}
/**
* {@inheritdoc}
*/
public function setQueued($is_queued) {
$this
->set('queued', $is_queued);
return $this;
}
/**
* {@inheritdoc}
*/
public function getCreatedTime() {
return $this
->get('created')->value;
}
/**
* {@inheritdoc}
*/
public function getSendTime() {
return $this
->get('send_on')->value;
}
/**
* {@inheritdoc}
*/
public function setSendTime($send_time) {
$this
->set('send_on', $send_time);
return $this;
}
/**
* {@inheritdoc}
*/
public function getProcessedTime() {
return $this
->get('processed')->value;
}
/**
* {@inheritdoc}
*/
public function setProcessedTime($processed) {
$this
->set('processed', $processed);
return $this;
}
/**
* {@inheritdoc}
*/
public function chunkByRecipients($size) {
$recipients_all = $this
->getRecipients();
// Save processing by returning early.
if ($size < 1 || count($recipients_all) <= $size) {
return [
$this,
];
}
// Create a baseline SMS message with recipients cleaned out.
$base = $this
->createDuplicate();
$base
->removeRecipients($recipients_all);
$messages = [];
foreach (array_chunk($recipients_all, $size) as $recipients) {
$messages[] = $base
->createDuplicate()
->addRecipients($recipients);
}
return $messages;
}
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
// Identifiers.
$fields['id'] = BaseFieldDefinition::create('integer')
->setLabel(t('SMS message ID'))
->setDescription(t('The SMS message ID.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The SMS message UUID.'))
->setReadOnly(TRUE);
$fields['gateway'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Gateway Plugin'))
->setDescription(t('The gateway plugin instance.'))
->setSetting('target_type', 'sms_gateway')
->setReadOnly(TRUE)
->setRequired(TRUE);
$fields['direction'] = BaseFieldDefinition::create('integer')
->setLabel(t('Transmission direction'))
->setDescription(t('Transmission direction, See SmsMessageInterface::DIRECTION_*.'))
->setReadOnly(TRUE)
->setSetting('unsigned', FALSE)
->setSetting('size', 'tiny')
->setRequired(TRUE);
// Sender and receivers.
$fields['sender_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Sender name'))
->setDescription(t('The name of the sender.'))
->setRequired(FALSE);
$fields['sender_phone_number'] = BaseFieldDefinition::create('telephone')
->setLabel(t('Sender phone number'))
->setDescription(t('The phone number of the sender.'))
->setDefaultValue('')
->setRequired(FALSE);
$fields['sender_entity'] = BaseFieldDefinition::create('dynamic_entity_reference')
->setLabel(t('Sender entity'))
->setDescription(t('The entity who sent the SMS message.'))
->setRequired(FALSE);
$fields['recipient_phone_number'] = BaseFieldDefinition::create('telephone')
->setLabel(t('Recipient phone number'))
->setDescription(t('The phone number of the recipient.'))
->setRequired(FALSE)
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED);
$fields['recipient_entity'] = BaseFieldDefinition::create('dynamic_entity_reference')
->setLabel(t('Recipient entity'))
->setDescription(t('The entity who received the SMS message.'))
->setRequired(FALSE);
// Meta information.
$fields['options'] = BaseFieldDefinition::create('map')
->setLabel(t('Options'))
->setDescription(t('Options to pass to the gateway.'));
$fields['automated'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Is automated'))
->setDescription(t('Whether this SMS message was generated automatically. 0=generated by user action, 1=generated automatically.'))
->setDefaultValue(TRUE)
->setRequired(TRUE)
->setSetting('on_label', t('Automated'))
->setSetting('off_label', t('Not automated'));
$fields['queued'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Queued'))
->setDescription(t('Whether the SMS message is in the queue to be processed.'))
->setDefaultValue(FALSE)
->setRequired(TRUE)
->setSetting('on_label', t('Queued'))
->setSetting('off_label', t('Not queued'));
// Dates.
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Creation date'))
->setDescription(t('The time the SMS message was created.'))
->setRequired(TRUE);
$fields['send_on'] = BaseFieldDefinition::create('created')
->setLabel(t('Send date'))
->setDescription(t('The time to send the SMS message.'))
->setRequired(TRUE);
$fields['processed'] = BaseFieldDefinition::create('timestamp')
->setLabel(t('Processed'))
->setDescription(t('The time the SMS message was processed. This value does not indicate whether the message was sent, only that the gateway accepted the request.'))
->setRequired(FALSE);
// Message contents.
$fields['message'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Message'))
->setDescription(t('The SMS message.'))
->setDefaultValue('')
->setRequired(TRUE);
return $fields;
}
/**
* Converts a standard SMS message object to a SMS message entity.
*
* @param \Drupal\sms\Message\SmsMessageInterface $sms_message
* A standard SMS message.
*
* @return static
* An unsaved SMS Message entity.
*/
public static function convertFromSmsMessage(StdSmsMessageInterface $sms_message) {
if ($sms_message instanceof static) {
return $sms_message;
}
$new = static::create();
$new
->setDirection($sms_message
->getDirection())
->setAutomated($sms_message
->isAutomated())
->setSender($sms_message
->getSender())
->setSenderNumber($sms_message
->getSenderNumber())
->addRecipients($sms_message
->getRecipients())
->setMessage($sms_message
->getMessage())
->setResult($sms_message
->getResult());
if ($gateway = $sms_message
->getGateway()) {
$new
->setGateway($gateway);
}
if ($uid = $sms_message
->getUid()) {
$new
->setUid($uid);
}
foreach ($sms_message
->getOptions() as $k => $v) {
$new
->setOption($k, $v);
}
return $new;
}
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
$results = [];
$reports = [];
/** @var \Drupal\sms\Entity\SmsMessageInterface $sms_message */
foreach ($entities as $sms_message) {
// Since the $sms_message can have both in-memory and stored objects, only
// need to delete actual stored entities.
if (($result = $sms_message
->getResult()) && $result instanceof EntityInterface) {
$results[] = $result;
}
foreach ($sms_message
->getReports() as $report) {
if ($report instanceof EntityInterface) {
$reports[] = $report;
}
}
}
\Drupal::entityTypeManager()
->getStorage('sms_result')
->delete($results);
\Drupal::entityTypeManager()
->getStorage('sms_report')
->delete($reports);
}
/**
* {@inheritdoc}
*/
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
// Save the result and reports in the static cache.
if ($this->result) {
$result_entity = SmsMessageResult::convertFromMessageResult($this->result);
$result_entity
->setSmsMessage($this)
->save();
foreach ($this->result
->getReports() as $report) {
$report_entity = SmsDeliveryReport::convertFromDeliveryReport($report);
$report_entity
->setSmsMessage($this)
->save();
}
// Unset $this->result as we don't need it anymore after save.
unset($this->result);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
ContentEntityBase:: |
protected | property | Language code identifying the entity active language. | |
ContentEntityBase:: |
protected | property | Local cache for the default language code. | |
ContentEntityBase:: |
protected | property | The default langcode entity key. | |
ContentEntityBase:: |
protected | property | Whether the revision translation affected flag has been enforced. | |
ContentEntityBase:: |
protected | property | Holds untranslatable entity keys such as the ID, bundle, and revision ID. | |
ContentEntityBase:: |
protected | property | Local cache for field definitions. | |
ContentEntityBase:: |
protected | property | The array of fields, each being an instance of FieldItemListInterface. | |
ContentEntityBase:: |
protected static | property | Local cache for fields to skip from the checking for translation changes. | |
ContentEntityBase:: |
protected | property | Indicates whether this is the default revision. | |
ContentEntityBase:: |
protected | property | The language entity key. | |
ContentEntityBase:: |
protected | property | Local cache for the available language objects. | |
ContentEntityBase:: |
protected | property | The loaded revision ID before the new revision was set. | |
ContentEntityBase:: |
protected | property | Boolean indicating whether a new revision should be created on save. | |
ContentEntityBase:: |
protected | property | The revision translation affected entity key. | |
ContentEntityBase:: |
protected | property | Holds translatable entity keys such as the label. | |
ContentEntityBase:: |
protected | property | A flag indicating whether a translation object is being initialized. | |
ContentEntityBase:: |
protected | property | An array of entity translation metadata. | |
ContentEntityBase:: |
protected | property | Whether entity validation was performed. | |
ContentEntityBase:: |
protected | property | Whether entity validation is required before saving the entity. | |
ContentEntityBase:: |
protected | property | The plain data values of the contained fields. | |
ContentEntityBase:: |
public | function |
Checks data value access. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Adds a new translation to the translatable object. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the bundle of the entity. Overrides EntityBase:: |
|
ContentEntityBase:: |
public static | function |
Provides field definitions for a specific bundle. Overrides FieldableEntityInterface:: |
4 |
ContentEntityBase:: |
protected | function | Clear entity translation object cache to remove stale references. | |
ContentEntityBase:: |
public | function |
Creates a duplicate of the entity. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Gets a field item list. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Gets the value of the given entity key, if defined. | 1 |
ContentEntityBase:: |
public | function |
Gets the definition of a contained field. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of field definitions of all contained fields. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of all field item lists. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Returns an array of field names to skip in ::hasTranslationChanges. | 1 |
ContentEntityBase:: |
public | function | ||
ContentEntityBase:: |
protected | function | ||
ContentEntityBase:: |
public | function |
Gets the loaded Revision ID of the entity. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the revision identifier of the entity. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of field item lists for translatable fields. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Gets a translated field. | |
ContentEntityBase:: |
public | function |
Gets a translation of the data. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the languages the data is translated to. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translation status. Overrides TranslationStatusInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translatable object referring to the original language. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines whether the entity has a field with the given name. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Checks there is a translation for the given language code. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines if the current translation of the entity has unsaved changes. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the identifier. Overrides EntityBase:: |
|
ContentEntityBase:: |
protected | function | Instantiates a translation object for an existing translation. | |
ContentEntityBase:: |
public | function |
Checks if this entity is the default revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the translation is the default one. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if untranslatable fields should affect only the default translation. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if this entity is the latest revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether this is the latest revision affecting this translation. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines whether a new revision should be created on save. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the translation is new. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the current translation is affected by the current revision. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if the revision translation affected flag value has been enforced. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translation support status. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether entity validation is required before saving the entity. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the label of the entity. Overrides EntityBase:: |
2 |
ContentEntityBase:: |
public | function |
Gets the language of the entity. Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Reacts to changes to a field. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Acts on a created entity before hooks are invoked. Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Acts on an entity before the presave hook is invoked. Overrides EntityBase:: |
5 |
ContentEntityBase:: |
public | function |
Acts on a revision before it gets saved. Overrides RevisionableInterface:: |
2 |
ContentEntityBase:: |
public | function |
Gets a list of entities referenced by this entity. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Removes the translation identified by the given language code. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Sets a field value. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Populates the local cache for the default language code. | |
ContentEntityBase:: |
public | function |
Enforces an entity to be saved as a new revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Marks the current revision translation as affected. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Enforces the revision translation affected flag value. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Sets whether entity validation is required before saving the entity. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of all property values. Overrides EntityBase:: |
|
ContentEntityBase:: |
protected | function | Updates language for already instantiated fields. | |
ContentEntityBase:: |
public | function |
Updates the loaded Revision ID with the revision ID. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function | Updates the original values with the interim changes. | |
ContentEntityBase:: |
public | function |
Gets the entity UUID (Universally Unique Identifier). Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Validates the currently set values. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the entity object was a default revision when it was saved. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function | Magic method: Implements a deep clone. | |
ContentEntityBase:: |
public | function |
Constructs an Entity object. Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function | Implements the magic method for getting object properties. | |
ContentEntityBase:: |
public | function | Implements the magic method for isset(). | |
ContentEntityBase:: |
public | function | Implements the magic method for setting object properties. | |
ContentEntityBase:: |
public | function |
Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function | Implements the magic method for unset(). | |
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 | Aliased as: traitSleep | 1 |
DependencySerializationTrait:: |
public | function | 2 | |
EntityBase:: |
protected | property | Boolean indicating whether the entity should be forced to be new. | |
EntityBase:: |
protected | property | The entity type. | |
EntityBase:: |
protected | property | A typed data object wrapping this entity. | |
EntityBase:: |
public static | function |
Constructs a new entity object, without permanently saving it. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Deletes an entity permanently. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Enforces an entity to be new. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | Gets the entity manager. | |
EntityBase:: |
protected | function | Gets the entity type bundle info service. | |
EntityBase:: |
protected | function | Gets the entity type manager. | |
EntityBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the key that is used to store configuration dependencies. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the configuration dependency name. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets the configuration target identifier for the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets the entity type definition. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the ID of the type of the entity. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | The list cache tags to invalidate for this entity. | |
EntityBase:: |
public | function |
Gets the original ID. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets a typed data object for this entity object. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Indicates if a link template exists for a given key. Overrides EntityInterface:: |
|
EntityBase:: |
protected static | function | Invalidates an entity's cache tags upon delete. | 1 |
EntityBase:: |
protected | function | Invalidates an entity's cache tags upon save. | 1 |
EntityBase:: |
public | function |
Determines whether the entity is new. Overrides EntityInterface:: |
2 |
EntityBase:: |
protected | function | Gets the language manager. | |
EntityBase:: |
public | function |
Deprecated way of generating a link to the entity. See toLink(). Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets an array link templates. | 1 |
EntityBase:: |
public static | function |
Loads an entity. Overrides EntityInterface:: |
|
EntityBase:: |
public static | function |
Loads one or more entities. Overrides EntityInterface:: |
|
EntityBase:: |
public static | function |
Acts on loaded entities. Overrides EntityInterface:: |
2 |
EntityBase:: |
public static | function |
Changes the values of an entity before it is created. Overrides EntityInterface:: |
5 |
EntityBase:: |
public static | function |
Acts on entities before they are deleted and before hooks are invoked. Overrides EntityInterface:: |
4 |
EntityBase:: |
public | function |
Saves an entity permanently. Overrides EntityInterface:: |
3 |
EntityBase:: |
public | function |
Sets the original ID. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Generates the HTML for a link to this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets a list of URI relationships supported by this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the public URL for this entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets an array of placeholders for this entity. | 2 |
EntityBase:: |
protected | function | Gets the UUID generator. | |
EntityChangesDetectionTrait:: |
protected | function | Returns an array of field names to skip when checking for changes. Aliased as: traitGetFieldsToSkipFromTranslationChangesCheck | |
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
SmsMessage:: |
protected | property | Temporarily stores the message result until save(). | |
SmsMessage:: |
public | function |
Adds a single recipient to the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Adds multiple recipients to the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public static | function |
Provides base field definitions for an entity type. Overrides ContentEntityBase:: |
|
SmsMessage:: |
public | function |
Split this SMS message into new messages by chunks of recipients. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public static | function | Converts a standard SMS message object to a SMS message entity. | |
SmsMessage:: |
public | function |
Get the creation timestamp of the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Get direction of the message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Get the gateway for this message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the message to be sent. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the option specified by the key $name. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the options for building or sending this SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
The time the SMS message was processed. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the entity who will receive the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the list of recipients of this SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the delivery report for a particular recipient. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the delivery reports for all recipients. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Get the result associated with this SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the name of the sender of this SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the entity who sent the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Get phone number of the sender. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Get the time to send the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the user who created the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets the UUID of the SMS object. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Gets whether this SMS message was generated automatically. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Get whether the SMS message is in the queue to be processed. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public static | function |
Acts on deleted entities before the delete hook is invoked. Overrides EntityBase:: |
|
SmsMessage:: |
public | function |
Acts on a saved entity before the insert or update hook is invoked. Overrides ContentEntityBase:: |
|
SmsMessage:: |
public | function |
Removes an option from this SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Removes a single recipient from the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Removes multiple recipients from the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Sets whether this SMS message was generated automatically. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set direction of the message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set the gateway for this message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set the message to be sent. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Sets an option for this SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set the time the SMS message was processed. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Get whether the SMS message is in the queue to be processed. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set the entity who will receive the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Sets the result associated with this SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set the entity who sent the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set the phone number of the sender. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set the time to send the SMS message. Overrides SmsMessageInterface:: |
|
SmsMessage:: |
public | function |
Set the user who created the SMS message. Overrides SmsMessageInterface:: |
|
SynchronizableEntityTrait:: |
protected | property | Whether this entity is being created, updated or deleted through a synchronization process. | |
SynchronizableEntityTrait:: |
public | function | ||
SynchronizableEntityTrait:: |
public | function | ||
TranslationStatusInterface:: |
constant | Status code identifying a newly created translation. | ||
TranslationStatusInterface:: |
constant | Status code identifying an existing translation. | ||
TranslationStatusInterface:: |
constant | Status code identifying a removed translation. |