/bin/bash: q : commande introuvable

This commit is contained in:
Manuel Raynaud
2013-08-14 16:24:22 +02:00
parent b731a767d5
commit 1db41a36ab
3 changed files with 131 additions and 25 deletions

View File

@@ -52,13 +52,13 @@ class Cart extends BaseAction implements EventSubscriberInterface
public function addItem(CartEvent $event) public function addItem(CartEvent $event)
{ {
$cart = $event->cart; $cart = $event->getCart();
$newness = $event->newness; $newness = $event->getNewness();
$append = $event->append; $append = $event->getAppend();
$quantity = $event->quantity; $quantity = $event->getQuantity();
$productSaleElementsId = $event->productSaleElementsId; $productSaleElementsId = $event->getProductSaleElementsId();
$productId = $event->product; $productId = $event->getProduct();
$cartItem = $this->findItem($cart->getId(), $productId, $productSaleElementsId); $cartItem = $this->findItem($cart->getId(), $productId, $productSaleElementsId);
@@ -83,8 +83,8 @@ class Cart extends BaseAction implements EventSubscriberInterface
*/ */
public function deleteItem(CartEvent $event) public function deleteItem(CartEvent $event)
{ {
if (null !== $cartItemId = $event->cartItem) { if (null !== $cartItemId = $event->getCartItem()) {
$cart = $event->cart; $cart = $event->getCart();
$cartItem = CartItemQuery::create() $cartItem = CartItemQuery::create()
->filterByCartId($cart->getId()) ->filterByCartId($cart->getId())
->filterById($cartItemId) ->filterById($cartItemId)
@@ -103,8 +103,8 @@ class Cart extends BaseAction implements EventSubscriberInterface
*/ */
public function changeItem(CartEvent $event) public function changeItem(CartEvent $event)
{ {
if ((null !== $cartItemId = $event->cartItem) && (null !== $quantity = $event->quantity)) { if ((null !== $cartItemId = $event->getCartItem()) && (null !== $quantity = $event->getQuantity())) {
$cart = $event->cart; $cart = $event->getCart();
$cartItem = CartItemQuery::create() $cartItem = CartItemQuery::create()
->filterByCartId($cart->getId()) ->filterByCartId($cart->getId())

View File

@@ -44,11 +44,11 @@ class CartController extends BaseFrontController
$form = $this->validateForm($cartAdd); $form = $this->validateForm($cartAdd);
$cartEvent = $this->getCartEvent(); $cartEvent = $this->getCartEvent();
$cartEvent->newness = $form->get("newness")->getData(); $cartEvent->setNewness($form->get("newness")->getData());
$cartEvent->append = $form->get("append")->getData(); $cartEvent->setAppend($form->get("append")->getData());
$cartEvent->quantity = $form->get("quantity")->getData(); $cartEvent->setQuantity($form->get("quantity")->getData());
$cartEvent->productSaleElementsId = $form->get("product_sale_elements_id")->getData(); $cartEvent->setProductSaleElementsId($form->get("product_sale_elements_id")->getData());
$cartEvent->product = $form->get("product")->getData(); $cartEvent->setProduct($form->get("product")->getData());
$this->getDispatcher()->dispatch(TheliaEvents::CART_ADDITEM, $cartEvent); $this->getDispatcher()->dispatch(TheliaEvents::CART_ADDITEM, $cartEvent);
@@ -70,8 +70,8 @@ class CartController extends BaseFrontController
public function changeItem() public function changeItem()
{ {
$cartEvent = $this->getCartEvent(); $cartEvent = $this->getCartEvent();
$cartEvent->cartItem = $this->getRequest()->get("cart_item"); $cartEvent->setCartItem($this->getRequest()->get("cart_item"));
$cartEvent->quantity = $this->getRequest()->get("quantity"); $cartEvent->setQuantity($this->getRequest()->get("quantity"));
try { try {
$this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent); $this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent);
@@ -86,7 +86,7 @@ class CartController extends BaseFrontController
public function deleteItem() public function deleteItem()
{ {
$cartEvent = $this->getCartEvent(); $cartEvent = $this->getCartEvent();
$cartEvent->cartItem = $this->getRequest()->get("cart_item"); $cartEvent->setCartItem($this->getRequest()->get("cart_item"));
try { try {
$this->getDispatcher()->dispatch(TheliaEvents::CART_DELETEITEM, $cartEvent); $this->getDispatcher()->dispatch(TheliaEvents::CART_DELETEITEM, $cartEvent);

View File

@@ -28,16 +28,122 @@ use Thelia\Model\Cart;
class CartEvent extends Event class CartEvent extends Event
{ {
public $cart; protected $cart;
public $quantity; protected $quantity;
public $append; protected $append;
public $newness; protected $newness;
public $productSaleElementsId; protected $productSaleElementsId;
public $product; protected $product;
public $cartItem; protected $cartItem;
public function __construct(Cart $cart) public function __construct(Cart $cart)
{ {
$this->cart = $cart; $this->cart = $cart;
} }
/**
* @param mixed $append
*/
public function setAppend($append)
{
$this->append = $append;
}
/**
* @return mixed
*/
public function getAppend()
{
return $this->append;
}
/**
* @param mixed $cartItem
*/
public function setCartItem($cartItem)
{
$this->cartItem = $cartItem;
}
/**
* @return mixed
*/
public function getCartItem()
{
return $this->cartItem;
}
/**
* @param mixed $newness
*/
public function setNewness($newness)
{
$this->newness = $newness;
}
/**
* @return mixed
*/
public function getNewness()
{
return $this->newness;
}
/**
* @param mixed $product
*/
public function setProduct($product)
{
$this->product = $product;
}
/**
* @return mixed
*/
public function getProduct()
{
return $this->product;
}
/**
* @param mixed $productSaleElementsId
*/
public function setProductSaleElementsId($productSaleElementsId)
{
$this->productSaleElementsId = $productSaleElementsId;
}
/**
* @return mixed
*/
public function getProductSaleElementsId()
{
return $this->productSaleElementsId;
}
/**
* @param mixed $quantity
*/
public function setQuantity($quantity)
{
$this->quantity = $quantity;
}
/**
* @return mixed
*/
public function getQuantity()
{
return $this->quantity;
}
/**
* @return \Thelia\Model\Cart
*/
public function getCart()
{
return $this->cart;
}
} }