Drupal 8  8.0.2
Comment Class Reference
Inheritance diagram for Comment:

Public Member Functions

 preSave (EntityStorageInterface $storage)
 
 postSave (EntityStorageInterface $storage, $update=TRUE)
 
 referencedEntities ()
 
 permalink ()
 
 hasParentComment ()
 
 getParentComment ()
 
 getCommentedEntity ()
 
 getCommentedEntityId ()
 
 getCommentedEntityTypeId ()
 
 setFieldName ($field_name)
 
 getFieldName ()
 
 getSubject ()
 
 setSubject ($subject)
 
 getAuthorName ()
 
 setAuthorName ($name)
 
 getAuthorEmail ()
 
 getHomepage ()
 
 setHomepage ($homepage)
 
 getHostname ()
 
 setHostname ($hostname)
 
 getCreatedTime ()
 
 setCreatedTime ($created)
 
 isPublished ()
 
 getStatus ()
 
 setPublished ($status)
 
 getThread ()
 
 setThread ($thread)
 
 getOwner ()
 
 getOwnerId ()
 
 setOwnerId ($uid)
 
 setOwner (UserInterface $account)
 
 getTypeId ()
 
- Public Member Functions inherited from ContentEntityBase
 __construct (array $values, $entity_type, $bundle=FALSE, $translations=array())
 
 postCreate (EntityStorageInterface $storage)
 
 setNewRevision ($value=TRUE)
 
 isNewRevision ()
 
 isDefaultRevision ($new_value=NULL)
 
 isRevisionTranslationAffected ()
 
 setRevisionTranslationAffected ($affected)
 
 isDefaultTranslation ()
 
 getRevisionId ()
 
 isTranslatable ()
 
 preSave (EntityStorageInterface $storage)
 
 preSaveRevision (EntityStorageInterface $storage,\stdClass $record)
 
 validate ()
 
 isValidationRequired ()
 
 setValidationRequired ($required)
 
 __sleep ()
 
 id ()
 
 bundle ()
 
 uuid ()
 
 hasField ($field_name)
 
 get ($field_name)
 
 set ($name, $value, $notify=TRUE)
 
 getFields ($include_computed=TRUE)
 
 getTranslatableFields ($include_computed=TRUE)
 
 getIterator ()
 
 getFieldDefinition ($name)
 
 getFieldDefinitions ()
 
 toArray ()
 
 access ($operation, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 language ()
 
 onChange ($name)
 
 getTranslation ($langcode)
 
 getUntranslated ()
 
 hasTranslation ($langcode)
 
 isNewTranslation ()
 
 removeTranslation ($langcode)
 
 getTranslationLanguages ($include_default=TRUE)
 
 updateOriginalValues ()
 
__get ($name)
 
 __set ($name, $value)
 
 __isset ($name)
 
 __unset ($name)
 
 createDuplicate ()
 
 __clone ()
 
 label ()
 
 referencedEntities ()
 
- Public Member Functions inherited from Entity
 __construct (array $values, $entity_type)
 
 id ()
 
 uuid ()
 
 isNew ()
 
 enforceIsNew ($value=TRUE)
 
 getEntityTypeId ()
 
 bundle ()
 
 label ()
 
 urlInfo ($rel= 'canonical', array $options=[])
 
 toUrl ($rel= 'canonical', array $options=[])
 
 hasLinkTemplate ($rel)
 
 link ($text=NULL, $rel= 'canonical', array $options=[])
 
 toLink ($text=NULL, $rel= 'canonical', array $options=[])
 
 url ($rel= 'canonical', $options=array())
 
 uriRelationships ()
 
 access ($operation, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 language ()
 
 save ()
 
 delete ()
 
 createDuplicate ()
 
 getEntityType ()
 
 preSave (EntityStorageInterface $storage)
 
 postSave (EntityStorageInterface $storage, $update=TRUE)
 
 postCreate (EntityStorageInterface $storage)
 
 referencedEntities ()
 
 getCacheContexts ()
 
 getCacheTagsToInvalidate ()
 
 getCacheTags ()
 
 getCacheMaxAge ()
 
 getOriginalId ()
 
 setOriginalId ($id)
 
 toArray ()
 
 getTypedData ()
 
 __sleep ()
 
 getConfigDependencyKey ()
 
 getConfigDependencyName ()
 
 getConfigTarget ()
 
- Public Member Functions inherited from RefinableCacheableDependencyInterface
 addCacheContexts (array $cache_contexts)
 
 addCacheTags (array $cache_tags)
 
 mergeCacheMaxAge ($max_age)
 
 addCacheableDependency ($other_object)
 
- Public Member Functions inherited from ContentEntityInterface
 hasTranslationChanges ()
 
- Public Member Functions inherited from TranslatableInterface
 addTranslation ($langcode, array $values=array())
 
- Public Member Functions inherited from EntityChangedInterface
 getChangedTime ()
 
 setChangedTime ($timestamp)
 
 getChangedTimeAcrossTranslations ()
 
- Public Member Functions inherited from EntityOwnerInterface
 setOwner (UserInterface $account)
 

Static Public Member Functions

static postDelete (EntityStorageInterface $storage, array $entities)
 
static baseFieldDefinitions (EntityTypeInterface $entity_type)
 
static bundleFieldDefinitions (EntityTypeInterface $entity_type, $bundle, array $base_field_definitions)
 
static preCreate (EntityStorageInterface $storage, array &$values)
 
- Static Public Member Functions inherited from ContentEntityBase
static bundleFieldDefinitions (EntityTypeInterface $entity_type, $bundle, array $base_field_definitions)
 
- Static Public Member Functions inherited from Entity
static preCreate (EntityStorageInterface $storage, array &$values)
 
static preDelete (EntityStorageInterface $storage, array $entities)
 
static postDelete (EntityStorageInterface $storage, array $entities)
 
static postLoad (EntityStorageInterface $storage, array &$entities)
 
static load ($id)
 
static loadMultiple (array $ids=NULL)
 
static create (array $values=array())
 
- Static Public Member Functions inherited from FieldableEntityInterface
static baseFieldDefinitions (EntityTypeInterface $entity_type)
 

Protected Member Functions

 releaseThreadLock ()
 
- Protected Member Functions inherited from ContentEntityBase
 getLanguages ()
 
 clearTranslationCache ()
 
 getTranslatedField ($name, $langcode)
 
 setDefaultLangcode ()
 
 updateFieldLangcodes ($langcode)
 
 initializeTranslation ($langcode)
 
 getEntityKey ($key)
 
- Protected Member Functions inherited from Entity
 entityManager ()
 
 entityTypeManager ()
 
 languageManager ()
 
 uuidGenerator ()
 
 linkTemplates ()
 
 urlRouteParameters ($rel)
 
 invalidateTagsOnSave ($update)
 

Protected Attributes

 $threadLock = ''
 
- Protected Attributes inherited from ContentEntityBase
 $values = array()
 
 $fields = array()
 
 $fieldDefinitions
 
 $languages
 
 $langcodeKey
 
 $defaultLangcodeKey
 
 $activeLangcode = LanguageInterface::LANGCODE_DEFAULT
 
 $defaultLangcode
 
 $translations = array()
 
 $translationInitialize = FALSE
 
 $newRevision = FALSE
 
 $isDefaultRevision = TRUE
 
 $entityKeys = array()
 
 $translatableEntityKeys = array()
 
 $validated = FALSE
 
 $validationRequired = FALSE
 
- Protected Attributes inherited from Entity
 $entityTypeId
 
 $enforceIsNew
 
 $typedData
 

Additional Inherited Members

- Data Fields inherited from ContentEntityBase
const TRANSLATION_REMOVED = 0
 
const TRANSLATION_EXISTING = 1
 
const TRANSLATION_CREATED = 2
 
- Data Fields inherited from CommentInterface
const NOT_PUBLISHED = 0
 
const PUBLISHED = 1
 
- Static Protected Member Functions inherited from Entity
static invalidateTagsOnDelete (EntityTypeInterface $entity_type, array $entities)
 

Detailed Description

Defines the comment entity class.

( id = "comment", label = ("Comment"), bundle_label = ("Content type"), handlers = { "storage" = "Drupal\comment\CommentStorage", "storage_schema" = "Drupal\comment\CommentStorageSchema", "access" = "Drupal\comment\CommentAccessControlHandler", "list_builder" = "Drupal\Core\Entity\EntityListBuilder", "view_builder" = "Drupal\comment\CommentViewBuilder", "views_data" = "Drupal\comment\CommentViewsData", "form" = { "default" = "Drupal\comment\CommentForm", "delete" = "Drupal\comment\Form\DeleteForm" }, "translation" = "Drupal\comment\CommentTranslationHandler" }, base_table = "comment", data_table = "comment_field_data", uri_callback = "comment_uri", translatable = TRUE, entity_keys = { "id" = "cid", "bundle" = "comment_type", "label" = "subject", "langcode" = "langcode", "uuid" = "uuid" }, links = { "canonical" = "/comment/{comment}", "delete-form" = "/comment/{comment}/delete", "edit-form" = "/comment/{comment}/edit", }, bundle_entity_type = "comment_type", field_ui_base_route = "entity.comment_type.edit_form", constraints = { "CommentName" = {} } )

Member Function Documentation

static baseFieldDefinitions ( EntityTypeInterface  $entity_type)
static

{}

References BaseFieldDefinition\create(), EntityTypeInterface\ID_MAX_LENGTH, FieldStorageConfig\NAME_MAX_LENGTH, and t().

Here is the call graph for this function:

static bundleFieldDefinitions ( EntityTypeInterface  $entity_type,
  $bundle,
array  $base_field_definitions 
)
static

{}

References Entity\load().

Here is the call graph for this function:

getAuthorEmail ( )

{Returns the comment author's email address.For anonymous authors, this is the value as typed in the comment form.

Returns
string The email address of the author of the comment.
}

Implements CommentInterface.

getAuthorName ( )

{Returns the comment author's name.For anonymous authors, this is the value as typed in the comment form.

Returns
string The name of the comment author.
}

Implements CommentInterface.

References Drupal\config().

Referenced by Comment\getOwner().

Here is the call graph for this function:

Here is the caller graph for this function:

getCommentedEntity ( )

{Returns the entity to which the comment is attached.

Returns
The entity on which the comment is attached.
}

Implements CommentInterface.

Referenced by Comment\permalink(), Comment\postSave(), and Comment\referencedEntities().

Here is the caller graph for this function:

getCommentedEntityId ( )

{Returns the ID of the entity to which the comment is attached.

Returns
int The ID of the entity to which the comment is attached.
}

Implements CommentInterface.

Referenced by Comment\referencedEntities().

Here is the caller graph for this function:

getCommentedEntityTypeId ( )

{Returns the type of the entity to which the comment is attached.

Returns
string An entity type.
}

Implements CommentInterface.

getCreatedTime ( )

{Returns the time that the comment was created.

Returns
int The timestamp of when the comment was created.
}

Implements CommentInterface.

getFieldName ( )

{Returns the name of the field the comment is attached to.

Returns
string The name of the field the comment is attached to.
}

Implements CommentInterface.

getHomepage ( )

{Returns the comment author's home page address.For anonymous authors, this is the value as typed in the comment form.

Returns
string The homepage address of the author of the comment.
}

Implements CommentInterface.

Referenced by Comment\getOwner().

Here is the caller graph for this function:

getHostname ( )

{Returns the comment author's hostname.

Returns
string The hostname of the author of the comment.
}

Implements CommentInterface.

getOwner ( )

{Returns the entity owner's user entity.

Returns
The owner user entity.
}

Implements EntityOwnerInterface.

References User\getAnonymousUser(), Comment\getAuthorName(), and Comment\getHomepage().

Here is the call graph for this function:

getOwnerId ( )

{Returns the entity owner's user ID.

Returns
int|null The owner user ID, or NULL in case the user ID field has not been set on the entity.
}

Implements EntityOwnerInterface.

Referenced by Comment\preSave().

Here is the caller graph for this function:

getParentComment ( )

{Returns the parent comment entity if this is a reply to a comment.

Returns
|NULL A comment entity of the parent comment or NULL if there is no parent.
}

Implements CommentInterface.

Referenced by Comment\preSave().

Here is the caller graph for this function:

getStatus ( )

{Returns the comment's status.

Returns
int One of CommentInterface::PUBLISHED or CommentInterface::NOT_PUBLISHED
}

Implements CommentInterface.

getSubject ( )

{Returns the subject of the comment.

Returns
string The subject of the comment.
}

Implements CommentInterface.

getThread ( )

{Returns the alphadecimal representation of the comment's place in a thread.

Returns
string The alphadecimal representation of the comment's place in a thread.
}

Implements CommentInterface.

Referenced by Comment\preSave().

Here is the caller graph for this function:

getTypeId ( )

Get the comment type ID for this comment.

Returns
string The ID of the comment type.

Implements CommentInterface.

References ContentEntityBase\bundle().

Here is the call graph for this function:

hasParentComment ( )

{Determines if this comment is a reply to another comment.

Returns
bool TRUE if the comment has a parent comment otherwise FALSE.
}

Implements CommentInterface.

Referenced by Comment\preSave().

Here is the caller graph for this function:

isPublished ( )

{Checks if the comment is published.

Returns
bool TRUE if the comment is published.
}

Implements CommentInterface.

References CommentInterface\PUBLISHED.

permalink ( )

{Returns the permalink URL for this comment.

Returns
}

Implements CommentInterface.

References Comment\getCommentedEntity().

Here is the call graph for this function:

static postDelete ( EntityStorageInterface  $storage,
array  $entities 
)
static

{}

References Drupal\service().

Here is the call graph for this function:

postSave ( EntityStorageInterface  $storage,
  $update = TRUE 
)

{}

References Comment\getCommentedEntity(), Cache\invalidateTags(), Comment\releaseThreadLock(), and Drupal\service().

Here is the call graph for this function:

static preCreate ( EntityStorageInterface  $storage,
array &  $values 
)
static

{}

References FieldStorageConfig\loadByName().

Here is the call graph for this function:

preSave ( EntityStorageInterface  $storage)
referencedEntities ( )

{Gets a list of entities referenced by this entity.

Returns
[] An array of entities.
}

Implements EntityInterface.

References Comment\getCommentedEntity(), and Comment\getCommentedEntityId().

Here is the call graph for this function:

releaseThreadLock ( )
protected

Release the lock acquired for the thread in preSave().

References Drupal\lock().

Referenced by Comment\postSave().

Here is the call graph for this function:

Here is the caller graph for this function:

setAuthorName (   $name)

{Sets the name of the author of the comment.

Parameters
string$nameA string containing the name of the author.
Returns
$this The class instance that this method is called on.
}

Implements CommentInterface.

References ContentEntityBase\set().

Referenced by Comment\preSave().

Here is the call graph for this function:

Here is the caller graph for this function:

setCreatedTime (   $created)

{Sets the creation date of the comment.

Parameters
int$createdThe timestamp of when the comment was created.
Returns
$this The class instance that this method is called on.
}

Implements CommentInterface.

References ContentEntityBase\set().

Here is the call graph for this function:

setFieldName (   $field_name)

{Sets the field ID for which this comment is attached.

Parameters
string$field_nameThe field name through which the comment was added.
Returns
$this The class instance that this method is called on.
}

Implements CommentInterface.

References ContentEntityBase\set().

Here is the call graph for this function:

setHomepage (   $homepage)

{Sets the comment author's home page address.For anonymous authors, this is the value as typed in the comment form.

Parameters
string$homepageThe homepage address of the author of the comment.
Returns
$this The class instance that this method is called on.
}

Implements CommentInterface.

References ContentEntityBase\set().

Here is the call graph for this function:

setHostname (   $hostname)

{Sets the hostname of the author of the comment.

Parameters
string$hostnameThe hostname of the author of the comment.
Returns
$this The class instance that this method is called on.
}

Implements CommentInterface.

References ContentEntityBase\set().

Referenced by Comment\preSave().

Here is the call graph for this function:

Here is the caller graph for this function:

setOwner ( UserInterface  $account)

{}

References ContentEntityBase\set().

Here is the call graph for this function:

setOwnerId (   $uid)

{Sets the entity owner's user ID.

Parameters
int$uidThe owner user id.
Returns
$this
}

Implements EntityOwnerInterface.

References ContentEntityBase\set().

Here is the call graph for this function:

setPublished (   $status)

{Sets the published status of the comment entity.

Parameters
bool$statusSet to TRUE to publish the comment, FALSE to unpublish.
Returns
The class instance that this method is called on.
}

Implements CommentInterface.

References CommentInterface\NOT_PUBLISHED, CommentInterface\PUBLISHED, and ContentEntityBase\set().

Referenced by Comment\preSave().

Here is the call graph for this function:

Here is the caller graph for this function:

setSubject (   $subject)

{Sets the subject of the comment.

Parameters
string$subjectThe subject of the comment.
Returns
$this The class instance that this method is called on.
}

Implements CommentInterface.

References ContentEntityBase\set().

Here is the call graph for this function:

setThread (   $thread)

{Sets the alphadecimal representation of the comment's place in a thread.

Parameters
string$threadThe alphadecimal representation of the comment's place in a thread.
Returns
$this The class instance that this method is called on.
}

Implements CommentInterface.

References ContentEntityBase\set().

Referenced by Comment\preSave().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

$threadLock = ''
protected

The thread for which a lock was acquired.


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