src/Flowcode/ShopBundle/Service/ProductOrderService.php
public function clearDrafts()
    {
        $interval = new \DateInterval('P1D');
        $dateTo = new \DateTime();
        $dateTo->sub($interval);

        $orders = $this->productOrderRepository->getDraftsBetween(null, $dateTo);

        $processedCount = 0;

        /** @var ProductOrder $productOrder */
        foreach ($orders as $productOrder) {
            $productOrder->setEnabled(false);
            $processedCount++;
        }

        $this->getEm()->flush();

        return [
            'processed' => $processedCount
        ];
    }
public function clearDrafts()
    {
        $interval = new \DateInterval('P1D');
        $dateTo = new \DateTime();
        $dateTo->sub($interval);

        $orders = $this->productOrderRepository->getDraftsBetween(null, $dateTo);

        $processedCount = 0;

        /** @var ProductOrder $productOrder */
        foreach ($orders as $productOrder) {
            $productOrder->setEnabled(false);
            $processedCount++;
        }

        $this->getEm()->flush();

        return [
            'processed' => $processedCount
        ];
    }
public function clearDrafts ( ) { $ interval = new \ DateInterval ( 'P1D' ) ; $ dateTo = new \ DateTime ( ) ; $ dateTo -> sub ( $ interval ) ; $ orders = $ this -> productOrderRepository -> getDraftsBetween ( null , $ dateTo ) ; $ processedCount = 0 ; /** @var ProductOrder $productOrder */ foreach ( $ orders as $ productOrder ) { $ productOrder -> setEnabled ( false ) ; $ processedCount ++ ; } $ this -> getEm ( ) -> flush ( ) ; return [ 'processed' => $ processedCount ] ; }
Disable old draft orders.
@return array
Disable old draft orders .