setViews example

$translation = $this->getBlogTranslation($data);
        $data = array_merge($data$translation);

        $blog = new Blog();

        $blog->setId((int) $data['__blog_id']);
        $blog->setTitle($data['__blog_title']);
        $blog->setAuthorId($data['__blog_author_id'] !== null ? (int) $data['__blog_author_id'] : null);
        $blog->setActive((bool) $data['__blog_active']);
        $blog->setShortDescription($data['__blog_short_description']);
        $blog->setDescription($data['__blog_description']);
        $blog->setViews((int) $data['__blog_views']);
        $blog->setDisplayDate($data['__blog_display_date'] ? date_create($data['__blog_display_date']) : null);
        $blog->setCategoryId((int) $data['__blog_category_id']);
        $blog->setTemplate($data['__blog_template']);
        $blog->setMetaKeywords($data['__blog_meta_keywords']);
        $blog->setMetaDescription($data['__blog_meta_description']);
        $blog->setMetaTitle($data['__blog_meta_title']);

        if (isset($data['__blogAttribute_id'])) {
            $attributeData = $this->extractFields('__blogAttribute_', $data);
            $attribute = $this->attributeHydrator->hydrate($attributeData);
            $blog->addAttribute('core', $attribute);
        }
if ($date === null) {
            $date = new DateTime();
        }
        /** @var Banner|null $bannerStatistics */
        $bannerStatistics = $this->findOneBy(['bannerId' => $bannerId, 'displayDate' => $date]);

        // If no Entry for this day exists - create a new one         if (!$bannerStatistics instanceof Banner) {
            $bannerStatistics = new Banner($bannerId$date);

            $bannerStatistics->setClicks(0);
            $bannerStatistics->setViews(0);
        }

        return $bannerStatistics;
    }

    /** * Returns an instance of the \Doctrine\ORM\Query object which select the article impression * * @param int $articleId * @param int $shopId * @param DateTimeInterface|null $date * @param string|null $deviceType * * @return Query<ArticleImpression> */
Home | Imprint | This part of the site doesn't use cookies.