setHeadline example

/** @var Blog $blog */
        $blog = $this->getRepository()->find($blogArticleId);
        /** @var Shop $shop */
        $shop = $this->getModelManager()->getReference(Shop::class$this->get('shop')->getId());

        $blogCommentModel->setBlog($blog);
        $blogCommentModel->setCreationDate(new DateTime());
        $blogCommentModel->setActive(false);

        $blogCommentModel->setName($commentData['name']);
        $blogCommentModel->setEmail($commentData['eMail']);
        $blogCommentModel->setHeadline($commentData['headline']);
        $blogCommentModel->setComment($commentData['comment']);
        $blogCommentModel->setPoints($commentData['points']);
        $blogCommentModel->setShop($shop);

        $this->get('models')->persist($blogCommentModel);
        $this->get('models')->flush();
    }

    /** * Returns all data needed to display the pager * * @param int $totalResult * @param int $limitEnd * @param int $page * @param int $categoryId * * @return array */
if (isset($data['__vote_datum']) && $data['__vote_datum'] != '0000-00-00 00:00:00') {
            $struct->setCreatedAt(
                new DateTime($data['__vote_datum'])
            );
        }

        if (isset($data['__vote_email'])) {
            $struct->setEmail($data['__vote_email']);
        }

        if (isset($data['__vote_headline'])) {
            $struct->setHeadline($data['__vote_headline']);
        }

        if (isset($data['__vote_answer'])) {
            $struct->setAnswer($data['__vote_answer']);
        }

        if (isset($data['__vote_answer_date'])) {
            $struct->setAnsweredAt(
                new DateTime($data['__vote_answer_date'])
            );
        }

        
/** * @return CommentStruct[] */
    private function hydrateComments(array $data): array
    {
        $comments = [];
        foreach ($data as $row) {
            $comment = new CommentStruct();

            $comment->setAuthor($row['authorName']);
            $comment->setText($row['text']);
            $comment->setHeadline($row['headline']);
            $comment->setRating((int) $row['rating']);

            if (isset($row['creationDate']) && !empty($row['creationDate'])) {
                $date = new DateTime($row['creationDate']['date']);
                $comment->setCreationDate($date);
            }
            $comments[] = $comment;
        }

        return $comments;
    }
}
Home | Imprint | This part of the site doesn't use cookies.