public function statsAction($id, $from, $to)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Actor $entity */
        $entity = $em->getRepository('EcommerceBundle:Product')->find($id);
        
        /** @var FrontManager $frontManager */
        $adminManager =  $this->container->get('admin_manager');
        $stats = $adminManager->getProductStats($entity, $from, $to);

        $label = array();
        $visits = array();
        foreach ($stats as  $stat) {
            $label[] = $stat['day'];
            $visits[] = $stat['visits'];
        }
        
        $returnValues = new \stdClass();
        $returnValues->count = count($stats);
        $returnValues->labels = implode(',', $label);
        $returnValues->visits = implode(',', $visits);

        return new JsonResponse($returnValues);
    }
public function statsAction($id, $from, $to)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Actor $entity */
        $entity = $em->getRepository('EcommerceBundle:Product')->find($id);
        
        /** @var FrontManager $frontManager */
        $adminManager =  $this->container->get('admin_manager');
        $stats = $adminManager->getProductStats($entity, $from, $to);

        $label = array();
        $visits = array();
        foreach ($stats as  $stat) {
            $label[] = $stat['day'];
            $visits[] = $stat['visits'];
        }
        
        $returnValues = new \stdClass();
        $returnValues->count = count($stats);
        $returnValues->labels = implode(',', $label);
        $returnValues->visits = implode(',', $visits);

        return new JsonResponse($returnValues);
    }
public function statsAction ( $ id , $ from , $ to ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; /** @var Actor $entity */ $ entity = $ em -> getRepository ( 'EcommerceBundle:Product' ) -> find ( $ id ) ; /** @var FrontManager $frontManager */ $ adminManager = $ this -> container -> get ( 'admin_manager' ) ; $ stats = $ adminManager -> getProductStats ( $ entity , $ from , $ to ) ; $ label = array ( ) ; $ visits = array ( ) ; foreach ( $ stats as $ stat ) { $ label [ ] = $ stat [ 'day' ] ; $ visits [ ] = $ stat [ 'visits' ] ; } $ returnValues = new \ stdClass ( ) ; $ returnValues -> count = count ( $ stats ) ; $ returnValues -> labels = implode ( ',' , $ label ) ; $ returnValues -> visits = implode ( ',' , $ visits ) ; return new JsonResponse ( $ returnValues ) ; }
Returns a list of Actor entities in JSON format.

@return JsonResponse

@Route("/stats/{id}/{from}/{to}", requirements={ "_format" = "json" }, defaults={ "_format" = "json" })
@Method("GET")
Returns a list of Actor entities in JSON format .