Banner example


    public function getOrCreateBannerStatsModel($bannerId, ?DateTimeInterface $date = null)
    {
        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> */
throw new ModelNotFoundException(Banner::class(int) $id);
            }
        } else {
            // Check if there are none files submitted             if (empty($mediaManagerData)) {
                $this->View()->assign([
                    'success' => false,
                    'errorMsg' => $this->namespace->get('no_banner_selected', 'No banner has been selected.')]);

                return;
            }
            $bannerModel = new Banner();
        }
        // Read data         $bannerModel->fromArray($params);

        // Set new image and extension if necessary         if (!empty($mediaManagerData)) {
            $bannerModel->setImage($mediaManagerData);
        }

        // Strip full qualified url         $mediaService = $this->get(MediaServiceInterface::class);
        
Home | Imprint | This part of the site doesn't use cookies.