51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace KupShop\OrderingBundle\Event;
|
|
|
|
class CartItemEvent extends CartEvent
|
|
{
|
|
/** Po vlozeni nove polozky do kosiku */
|
|
public const AFTER_INSERT_ITEM = 'kupshop.cart.after_insert_item';
|
|
|
|
/** Po aktualizaci položky */
|
|
public const AFTER_UPDATE_ITEM = 'kupshop.cart.after_update_item';
|
|
|
|
/** Po odstraneni polozky */
|
|
public const BEFORE_DELETE_ITEM = 'kupshop.cart.before_delete_item';
|
|
|
|
protected $item;
|
|
protected $differences;
|
|
protected $product;
|
|
|
|
public function __construct(\Cart $cart, array $item, $product = null, $differences = [])
|
|
{
|
|
parent::__construct($cart);
|
|
|
|
$this->item = $item;
|
|
$this->product = $product;
|
|
$this->differences = $differences;
|
|
}
|
|
|
|
public function setProduct(\Product|\Variation $product): self
|
|
{
|
|
$this->product = $product;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDifferences()
|
|
{
|
|
return $this->differences;
|
|
}
|
|
|
|
public function getItem(): array
|
|
{
|
|
return $this->item;
|
|
}
|
|
|
|
public function getProduct()
|
|
{
|
|
return $this->product;
|
|
}
|
|
}
|