tchoulom / ViewCounterBundle

This bundle is used to count the number of views of a page.
MIT License
15 stars 11 forks source link

Version 7 Ideas #17

Open tacman opened 5 months ago

tacman commented 5 months ago

Cool bundle, thanks for releasing it.

With the next major release, would you consider some of these?

// Viewcounter
    $viewcounter = $this->get('tchoulom.viewcounter')->getViewCounter($article);
    // For Symfony version >= 4
    $viewcounter = $this->viewcounter->getViewCounter($article);

    $em = $this->getDoctrine()->getEntityManager();

    if ($this->viewcounter->isNewView($viewcounter)) {
        $views = $this->viewcounter->getViews($article);
        $viewcounter->setIp($request->getClientIp());
        $viewcounter->setArticle($article);
        $viewcounter->setViewDate(new \DateTime('now'));