diff --git a/core/lib/Thelia/Action/Cart.php b/core/lib/Thelia/Action/Cart.php index bb1bfb55e..86674aedf 100755 --- a/core/lib/Thelia/Action/Cart.php +++ b/core/lib/Thelia/Action/Cart.php @@ -52,13 +52,13 @@ class Cart extends BaseAction implements EventSubscriberInterface public function addItem(CartEvent $event) { - $cart = $event->cart; - $newness = $event->newness; - $append = $event->append; - $quantity = $event->quantity; + $cart = $event->getCart(); + $newness = $event->getNewness(); + $append = $event->getAppend(); + $quantity = $event->getQuantity(); - $productSaleElementsId = $event->productSaleElementsId; - $productId = $event->product; + $productSaleElementsId = $event->getProductSaleElementsId(); + $productId = $event->getProduct(); $cartItem = $this->findItem($cart->getId(), $productId, $productSaleElementsId); @@ -83,8 +83,8 @@ class Cart extends BaseAction implements EventSubscriberInterface */ public function deleteItem(CartEvent $event) { - if (null !== $cartItemId = $event->cartItem) { - $cart = $event->cart; + if (null !== $cartItemId = $event->getCartItem()) { + $cart = $event->getCart(); $cartItem = CartItemQuery::create() ->filterByCartId($cart->getId()) ->filterById($cartItemId) @@ -103,8 +103,8 @@ class Cart extends BaseAction implements EventSubscriberInterface */ public function changeItem(CartEvent $event) { - if ((null !== $cartItemId = $event->cartItem) && (null !== $quantity = $event->quantity)) { - $cart = $event->cart; + if ((null !== $cartItemId = $event->getCartItem()) && (null !== $quantity = $event->getQuantity())) { + $cart = $event->getCart(); $cartItem = CartItemQuery::create() ->filterByCartId($cart->getId()) diff --git a/core/lib/Thelia/Controller/Front/CartController.php b/core/lib/Thelia/Controller/Front/CartController.php index b5a4f9f77..b143a0396 100644 --- a/core/lib/Thelia/Controller/Front/CartController.php +++ b/core/lib/Thelia/Controller/Front/CartController.php @@ -44,11 +44,11 @@ class CartController extends BaseFrontController $form = $this->validateForm($cartAdd); $cartEvent = $this->getCartEvent(); - $cartEvent->newness = $form->get("newness")->getData(); - $cartEvent->append = $form->get("append")->getData(); - $cartEvent->quantity = $form->get("quantity")->getData(); - $cartEvent->productSaleElementsId = $form->get("product_sale_elements_id")->getData(); - $cartEvent->product = $form->get("product")->getData(); + $cartEvent->setNewness($form->get("newness")->getData()); + $cartEvent->setAppend($form->get("append")->getData()); + $cartEvent->setQuantity($form->get("quantity")->getData()); + $cartEvent->setProductSaleElementsId($form->get("product_sale_elements_id")->getData()); + $cartEvent->setProduct($form->get("product")->getData()); $this->getDispatcher()->dispatch(TheliaEvents::CART_ADDITEM, $cartEvent); @@ -70,8 +70,8 @@ class CartController extends BaseFrontController public function changeItem() { $cartEvent = $this->getCartEvent(); - $cartEvent->cartItem = $this->getRequest()->get("cart_item"); - $cartEvent->quantity = $this->getRequest()->get("quantity"); + $cartEvent->setCartItem($this->getRequest()->get("cart_item")); + $cartEvent->setQuantity($this->getRequest()->get("quantity")); try { $this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent); @@ -86,7 +86,7 @@ class CartController extends BaseFrontController public function deleteItem() { $cartEvent = $this->getCartEvent(); - $cartEvent->cartItem = $this->getRequest()->get("cart_item"); + $cartEvent->setCartItem($this->getRequest()->get("cart_item")); try { $this->getDispatcher()->dispatch(TheliaEvents::CART_DELETEITEM, $cartEvent); diff --git a/core/lib/Thelia/Core/Event/CartEvent.php b/core/lib/Thelia/Core/Event/CartEvent.php index 4dc6d9d67..59e67e2bf 100644 --- a/core/lib/Thelia/Core/Event/CartEvent.php +++ b/core/lib/Thelia/Core/Event/CartEvent.php @@ -28,16 +28,122 @@ use Thelia\Model\Cart; class CartEvent extends Event { - public $cart; - public $quantity; - public $append; - public $newness; - public $productSaleElementsId; - public $product; - public $cartItem; + protected $cart; + protected $quantity; + protected $append; + protected $newness; + protected $productSaleElementsId; + protected $product; + protected $cartItem; public function __construct(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; + } + + }