getStatisticChartQuery example


    public function getChartDataAction()
    {
        $partnerId = (int) $this->Request()->getParam('partnerId');

        $fromDate = $this->getFromDate();
        $toDate = $this->getToDate();

        $repository = $this->get('models')->getRepository(Partner::class);

        // Get the information of the partner chart         $dataQuery = $repository->getStatisticChartQuery($partnerId$fromDate$toDate);
        $data = $dataQuery->getArrayResult();

        $this->View()->assign(['success' => true, 'data' => $data]);
    }

    /** * Creates or updates a new Partner * * @return void */
    public function savePartnerAction()
    {
$this->View()->assign('partnerStatisticToDate', $toDate->format('Y-m-d'));
        $this->View()->assign('partnerStatisticFromDate', $fromDate->format('Y-m-d'));

        // To get the right value cause 2012-02-02 is smaller than 2012-02-02 15:33:12         $toDate = $toDate->add(new DateInterval('P1D'));

        $repository = $this->get('models')->getRepository(Partner::class);

        // Get the information of the partner chart         $customerCurrencyFactor = Shopware()->Shop()->getCurrency()->getFactor();

        $dataQuery = $repository->getStatisticChartQuery($partnerId$fromDate$toDate$customerCurrencyFactor);
        $this->View()->assign('sPartnerOrderChartData', $dataQuery->getArrayResult());

        $dataQuery = $repository->getStatisticListQuery(null, null, null, $partnerId, false, $fromDate$toDate$customerCurrencyFactor);
        $this->View()->assign('sPartnerOrders', $dataQuery->getArrayResult());

        $dataQuery = $repository->getStatisticListQuery(null, null, null, $partnerId, true, $fromDate$toDate$customerCurrencyFactor);
        $this->View()->assign('sTotalPartnerAmount', $dataQuery->getOneOrNullResult(AbstractQuery::HYDRATE_ARRAY));
    }

    /** * Logout account and delete session * * @return void */
Home | Imprint | This part of the site doesn't use cookies.