Get entity that the original comment was made on in a comment thread
@return ElggEntity
164836
public function getOriginalContainer() {
		$container = $this;
		while ($container instanceof Comment) {
			$container = $container->getContainerEntity();
		}
		return ($container instanceof Comment) ? $this->getOwnerEntity() : $container;
	}
213329
public function getComments()
    {
        //setup the comments
        $comment_ids = $this->getIds('comment');

        $comments = array();

        //only shows comments if there are comment_ids in the story
        //body or if the story has directly been commented on
        if (!empty($comment_ids)) {
            sort($comment_ids);
            $size = 0;
            foreach ($comment_ids as $id) {
                if (isset($this->_loaded_nodes[$id])) {
                    $comment = $this->_loaded_nodes[$id];
                    if ($comment instanceof ComBaseDomainEntityComment) {
                        $comments[$id] = $comment;
                        ++$size;
                    }
                }
                if ($size == 10) {
                    break;
                }
            }
        }

        return $comments;
    }
207762
private function getCacheEntity($id)
    {
        $contextual_id = $this->getContextualId($id);

        if (null === $this->_entity || $this->_entity->getId() !== $contextual_id) {
            $this->_entity = $this->_repository->find($contextual_id);
        }

        return $this->_entity;
    }
149787
public function toEntity(): EntityInterface
    {
        $data = [];

        $entityProvider = $this->getEntityProvider();
        foreach (get_object_vars($this) as $property => $value) {
            $method = Inflector::variable('get ' . $property);

            if (method_exists($this, $method) && is_callable([$this, $method])) {
                $field = Inflector::underscore($property);
                $data[$field] = $this->$method();
            }
        }

        $entity = new $entityProvider($data);

        return $entity;
    }
711276
function () {
                var entities = this.entities;

                return entities.literal() || entities.variable() || entities.url() ||
                       entities.call()    || entities.keyword()  || entities.javascript() ||
                       this.comment();
            }
28913
public function getOriginalEntityState($id)
    {
        if (isset($this->entityStateReferences[$id])) {
            return $this->entityStateReferences[$id];
        }

        return null;
    }
693495
public static function getInstance() {

		if( !isset( self::$instance ) ) {

			self::$instance	= new CommentProperties();

			self::$instance->init( CoreGlobal::CONFIG_COMMENT );
		}

		return self::$instance;
	}
395000
public function update_discussion(discussion_entity $discussion) : ?discussion_entity {
        $discussionrecord = $this->get_legacy_factory()->to_legacy_object($discussion);
        if ($this->get_db()->update_record('forum_discussions', $discussionrecord)) {
            $records = $this->transform_db_records_to_entities([$discussionrecord]);

            return count($records) ? array_shift($records) : null;
        }

        return null;
    }
551051
protected function _commentNode()
    {
        $this->_codeNode();
        $token = $this->_stream->current(true);
        $this->_states['body'] = $token[1];
        $node = new NodeDef($this->_states['body'], 'comment');
        return $this->_contextualize($node);
    }
421680
public static function getCommentsSort() {
		$user_setting = elgg_get_plugin_user_setting('comments_order', 0, 'hypeInteractions');
		$setting = $user_setting ?: elgg_get_plugin_setting('comments_order', 'hypeInteractions');
		if ($setting == 'asc') {
			$setting = 'time_created::asc';
		} else if ($setting == 'desc') {
			$setting = 'time_created::desc';
		}
		return $setting;
	}
218895
public function getEntity()
    {
        if ($this->entity == false) {
            $config = $this->getDI()->get('config');
            $model = $this->getModel();
            $searchHelper = $this->getSearchHelper();
            $entity = $config['namespaces']['entities'] . $this->getControllerName('singular') . 'Entity';
            $entityPath = $config['application']['entitiesDir'] . $this->getControllerName('singular') . 'Entity.php';
            $defaultEntityNameSpace = $config['namespaces']['defaultEntity'];

            //check for file, otherwise load generic entity - it should work just fine
            if (file_exists($entityPath)) {
                $entity = new $entity($model, $searchHelper);
            } else {
                $entity = new $defaultEntityNameSpace($model, $searchHelper);
            }
            $this->entity = $this->configureEntity($entity);
        }
        return $this->entity;
    }
113789
@Override
    public EntityTransaction getTransaction()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "em.getTransaction();\n" + toString());

        return getEMInvocationInfo(false).getTransaction();
    }
1125971
public function getRootComment()
    {
        $result = $this;
        while (($parent = $result->getParentComment()) !== null) {
            $result = $parent;
        }

        return $result;
    }
1078379
protected function getReferenceComment()
    {
        $referenceComment = null;
        $commentSections = $this->getCommentSections();
        $lastLine = end($commentSections);

        if (preg_match('/^\s*Styleguide \w/i', $lastLine) ||
            preg_match('/^\s*No styleguide reference/i', $lastLine)
        ) {
            $referenceComment = $lastLine;
        }

        return $referenceComment;
    }
363897
public function getEntity()
    {
        $entity = $this->entityManager->getRepository($this->className)->find($this->id);
        if (!$entity) {
            throw new Error('Entity not found for class `' . $this->className . '` and ID `' . $this->id . '`.');
        }

        return $entity;
    }
1336453
function createComment() {
    $cnt = count( $this->comment );
     if( 0 >= $cnt )
      return;
    $comment = null;
    foreach( $this->comment as $commentPart ) {
      $attributes = $this->_createParams( $commentPart['params'], array( 'ALTREP', 'LANGUAGE' ));
      $content    = $this->_strrep( $commentPart['value'] );
      $comment   .= $this->_createElement( 'COMMENT', $attributes, $content );
    }
    return $comment;
  }
1195880
protected EntityDecl getIntEntity(int ch, final char[] originalChars)
    {
        String cacheKey = new String(originalChars);

        IntEntity entity = mCachedEntities.get(cacheKey);
        if (entity == null) {
            String repl;
            if (ch <= 0xFFFF) {
                repl = Character.toString((char) ch);
            } else {
                StringBuffer sb = new StringBuffer(2);
                ch -= 0x10000;
                sb.append((char) ((ch >> 10)  + 0xD800));
                sb.append((char) ((ch & 0x3FF)  + 0xDC00));
                repl = sb.toString();
            }
            entity = IntEntity.create(new String(originalChars), repl);
            mCachedEntities.put(cacheKey, entity);
        }
        return entity;
    }