Renders the description of the entity to which comment is attached to.

@param \Comment\Model\Entity\Comment $comment Comment entity
@return string
517927
protected function _inResponseTo(Comment $comment)
    {
        $this->loadModel('Content.Contents');
        $this->Contents->fieldable(false);
        $content = $this->Contents->get($comment->entity_id);

        if ($content) {
            $out = __d('content', '<a href="{0}" target="_blank">{1}</a>', Router::url(['plugin' => 'Content', 'controller' => 'manage', 'action' => 'edit', $content->id]), $content->title);
            $out .= '<br />';
            $out .= __d('content', '<a href="{0}" target="_blank">{1}</a>', Router::url($content->url), 'View content');

            return $out;
        }

        return __d('content', '-- Unknow --');
    }
157352
public function destroy(Comment $comment)
    {
        $this->authorize($comment);

        $comment->delete();
        
        return $this->makeRedirect(true, 'admin.comments.index', __('msg.destroy'));
    }
1303783
public function addComment($user, string $comment) : Comment
    {
        return $this->comments()->create([
            'user_id' => $user->id,
            'comment' => $comment,
        ]);
    }
1279462
public function addComment($comment)
    {
        $comment->setPaymentId($this->getPaymentId());
        $comment->save();

        $this->load($this->getPaymentId());

        return $comment;
    }
1218873
public function storeCookie( $comment = null )
    {
        $userData = array();
        $sessionID = session_id();
        $currentUser = eZUser::currentUser();
        if( is_null( $comment ) )
        {
            if( $currentUser->isAnonymous() )
            {
                return '';
            }
            else
            {
                $userData[$sessionID] = array( 'email' => $currentUser->attribute( 'email' ),
                                               'name' => $currentUser->contentObject()->name() );
            }
        }
        else
        {
            $userData[$sessionID] = array( 'email' => $comment->attribute( 'email' ),
                                           'website' => $comment->attribute( 'url' ),
                                           'name' => $comment->attribute( 'name' ) );
            if ( !$currentUser->isAnonymous() )
            {
                $userData[$sessionID]['email'] = $currentUser->attribute( 'email' );
            }
        }
        setcookie( 'eZCommentsUserData', base64_encode( json_encode( $userData ) ), $this->expiryTime, '/' );
        return $userData;
    }
413648
public function serialize(ResourceComment $comment, array $options = [])
    {
        $serialized = [
            'id' => $comment->getUuid(),
            'content' => $comment->getContent(),
            'user' => $comment->getUser() ? $this->userSerializer->serialize($comment->getUser(), [Options::SERIALIZE_MINIMAL]) : null,
            'creationDate' => $comment->getCreationDate() ? DateNormalizer::normalize($comment->getCreationDate()) : null,
            'editionDate' => $comment->getEditionDate() ? DateNormalizer::normalize($comment->getEditionDate()) : null,
        ];

        return $serialized;
    }
527841
protected function prepare_links( $comment ) {
		$links = array(
			'self' => array(
				'href' => rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $comment->comment_ID ) ),
			),
			'collection' => array(
				'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
			),
		);

		if ( 0 !== (int) $comment->user_id ) {
			$links['author'] = array(
				'href'       => rest_url( 'wp/v2/users/' . $comment->user_id ),
				'embeddable' => true,
			);
		}

		if ( 0 !== (int) $comment->comment_post_ID ) {
			$post = $this->get_post( $comment->comment_post_ID );
			if ( ! empty( $post->ID ) ) {
				$obj = get_post_type_object( $post->post_type );
				$base = ! empty( $obj->rest_base ) ? $obj->rest_base : $obj->name;

				$links['up'] = array(
					'href'       => rest_url( 'wp/v2/' . $base . '/' . $comment->comment_post_ID ),
					'embeddable' => true,
					'post_type'  => $post->post_type,
				);
			}
		}

		if ( 0 !== (int) $comment->comment_parent ) {
			$links['in-reply-to'] = array(
				'href'       => rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $comment->comment_parent ) ),
				'embeddable' => true,
			);
		}

		// Only grab one comment to verify the comment has children.
		$comment_children = $comment->get_children( array( 'number' => 1, 'count' => true ) );
		if ( ! empty( $comment_children ) ) {
			$args = array( 'parent' => $comment->comment_ID );
			$rest_url = add_query_arg( $args, rest_url( $this->namespace . '/' . $this->rest_base ) );

			$links['children'] = array(
				'href' => $rest_url,
			);
		}

		return $links;
	}
798360
protected function parseComment(Query $query, $comment)
    {
        if (false !== strpos($comment, '*/')) {
            $comment = strstr($comment, '*/', true);
        }

        return !empty($comment) ? ' /* ' . $comment . ' */' : '';
    }
396907
private function getCommentPeopleIDs(TranslatableCommentEntity $comment)
    {
        $result = [];
        $author = $comment->getPostedBy();
        if ($author !== null) {
            $result[] = $author->getUserID();
        }
        foreach ($comment->getChildComments() as $childComment) {
            $result = array_merge($result, $this->getCommentPeopleIDs($childComment));
        }

        return $result;
    }
251162
public function edit(Comment $comment)
    {
        $this->authorize($comment);

        pageinfo([
            'title' => __('comments.edit_page'),
            'robots' => 'noindex,follow',
        ]);

        return $this->makeResponse('edit', compact('comment'));
    }
329316
public function addComment(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Comment\Comment $comment)
    {
        $this->comments[] = $comment;

        return $this;
    }
1133994
public function addComment(\Haven\CmsBundle\Entity\Comment $comment)
    {
        $comment->setContent($this);
        $this->comments[] = $comment;

        return $this;
    }
177962
public function removeComment(\Haven\CmsBundle\Entity\Comment $comment)
    {
        $this->comments->removeElement($comment);
    }
1255204
public function removeComment(Comment $comment)
    {
        if ($this->comments->contains($comment)) {
            $this->comments->removeElement($comment);
            $comment->setTask(null);
        }

        return $this;
    }
1121767
protected function renderComment()
    {
        $merchant = $this->getMerchantName();

        if (($view = $this->getCommentView($merchant)) === null) {
            return '';
        }

        return $this->render($view, [
            'merchant' => $merchant,
            'widget' => $this,
            'event' => $this->event,
        ]);
    }
181093
private function updateFromPostCache(Comment $comment, $c)
    {
        if ($comment->postId == null)
        {
            return;
        }
        if ($this->postCache == null || $this->postCache['ID'] != $comment->postId)
        {
            $this->postCache = $this->adminApi->getPost($comment->postId);
        }

        $comment->date = $this->getMetaKeyValue($this->postCache, "linkoscope_created_$comment->id") ?: $c['date'];
        $comment->score =
            $this->getMetaKeyValue($this->postCache, "linkoscope_score_$comment->id") ?: strtotime($c['date']);
    }
1208742
protected function extractDescription($comments = '')
    {
        $description = '';
        $docs = explode("\n", $comments);
        if (count($docs)) {
            foreach ($docs as &$doc) {
                if (!preg_match('/(\*\*|\@)/', $doc) && preg_match('/\*\ /', $doc)) {
                    $doc = explode('* ', $doc);
                    $description = $doc[1];
                }
            }
        }

        return $description;
    }