no-return-functions block

This commit is contained in:
Etienne Roudeix
2013-09-17 14:59:40 +02:00
parent 233c952b4e
commit 8d20316217
13 changed files with 108 additions and 27 deletions

View File

@@ -60,7 +60,8 @@ class BaseFrontController extends BaseController
protected function checkCartNotEmpty()
{
if($this->getSession()->getCart()->countCartItems() == 0) {
$cart = $this->getSession()->getCart();
if($cart===null || $cart->countCartItems() == 0) {
$this->redirectToRoute("cart.view");
}
}

View File

@@ -29,7 +29,8 @@ use Thelia\Core\Event\TheliaEvents;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Form\OrderDelivery;
use Thelia\Log\Tlog;
use Thelia\Model\Base\AddressQuery;
use Thelia\Model\AddressQuery;
use Thelia\Model\AreaDeliveryModuleQuery;
use Thelia\Model\Order;
/**
@@ -53,9 +54,6 @@ class OrderController extends BaseFrontController
$orderDelivery = new OrderDelivery($this->getRequest());
$x = $this->getRequest();
$y = $_POST;
try {
$form = $this->validateForm($orderDelivery, "post");
@@ -69,7 +67,12 @@ class OrderController extends BaseFrontController
}
/* check that the delivery module fetch the delivery address area */
if(AreaDeliveryModuleQuery::create()
->filterByAreaId($deliveryAddress->getCountry()->getAreaId())
->filterByDeliveryModuleId()
->count() == 0) {
throw new \Exception("PUKE");
}
$orderEvent = $this->getOrderEvent();