update api documentation
This commit is contained in:
@@ -24,9 +24,8 @@
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
/**
|
||||
*
|
||||
* Class thrown on Thelia.action event
|
||||
@@ -43,32 +42,32 @@ abstract class ActionEvent extends Event
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $action;
|
||||
|
||||
protected $errorForm = null;
|
||||
|
||||
protected $parameters = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param string $action
|
||||
*/
|
||||
public function __construct(Request $request, $action)
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAction()
|
||||
public function __set($name, $value)
|
||||
{
|
||||
return $this->action;
|
||||
$this->parameters[$name] = $value;
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if (array_key_exists($name, $this->parameters)) {
|
||||
return $this->parameters[$name];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,18 +79,21 @@ abstract class ActionEvent extends Event
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function setErrorForm(BaseForm $form) {
|
||||
$this->errorForm = $form;
|
||||
public function setErrorForm(BaseForm $form)
|
||||
{
|
||||
$this->errorForm = $form;
|
||||
|
||||
if ($form != null) $this->stopPropagation();
|
||||
if ($form != null) $this->stopPropagation();
|
||||
}
|
||||
|
||||
public function getErrorForm() {
|
||||
return $this->errorForm;
|
||||
public function getErrorForm()
|
||||
{
|
||||
return $this->errorForm;
|
||||
}
|
||||
|
||||
public function hasErrorForm() {
|
||||
return $this->errorForm != null ? true : false;
|
||||
public function hasErrorForm()
|
||||
{
|
||||
return $this->errorForm != null ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,21 +21,130 @@
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Thelia\Model\Cart;
|
||||
|
||||
class CartEvent extends InternalEvent {
|
||||
|
||||
public $cart;
|
||||
class CartEvent extends Event
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,10 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
|
||||
use Thelia\Model\CartItem;
|
||||
|
||||
class CartItemEvent extends InternalEvent {
|
||||
|
||||
class CartItemEvent extends InternalEvent
|
||||
{
|
||||
protected $cartItem;
|
||||
|
||||
public function __construct(CartItem $cartItem)
|
||||
@@ -40,3 +39,4 @@ class CartItemEvent extends InternalEvent {
|
||||
return $this->cartItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,10 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
|
||||
use Thelia\Model\Category;
|
||||
|
||||
class CategoryEvent extends InternalEvent {
|
||||
|
||||
class CategoryEvent extends InternalEvent
|
||||
{
|
||||
public $category;
|
||||
|
||||
public function __construct(Category $category)
|
||||
@@ -35,3 +34,4 @@ class CategoryEvent extends InternalEvent {
|
||||
$this->category = $category;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Internal;
|
||||
|
||||
use Thelia\Model\Cart;
|
||||
|
||||
class CartEvent extends InternalEvent
|
||||
{
|
||||
public $cart;
|
||||
|
||||
public function __construct(Cart $cart)
|
||||
{
|
||||
$this->cart = $cart;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Internal;
|
||||
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
class CustomerEvent extends InternalEvent
|
||||
{
|
||||
public $customer;
|
||||
|
||||
public function __construct(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Internal;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Base class used for internal event like creating new Customer, adding item to cart, etc
|
||||
*
|
||||
* Class InternalEvent
|
||||
* @package Thelia\Core\Event
|
||||
*/
|
||||
abstract class InternalEvent extends Event
|
||||
{
|
||||
}
|
||||
|
||||
@@ -84,12 +84,6 @@ final class TheliaEvents
|
||||
*/
|
||||
const AFTER_CHANGECUSTOMER = "action.after_changecustomer";
|
||||
|
||||
/**
|
||||
* Sent before customer insertion, to allow modules to create a custom customer reference.
|
||||
*/
|
||||
const CREATECUSTOMER_CUSTOMREF = "customer.creation.customref";
|
||||
|
||||
|
||||
/**
|
||||
* Sent once the category creation form has been successfully validated, and before category insertion in the database.
|
||||
*/
|
||||
@@ -114,7 +108,6 @@ final class TheliaEvents
|
||||
*/
|
||||
const AFTER_CHANGECATEGORY = "action.after_changecategory";
|
||||
|
||||
|
||||
/**
|
||||
* sent when a new existing cat id duplicated. This append when current customer is different from current cart
|
||||
*/
|
||||
@@ -123,10 +116,23 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent when a new item is added to current cart
|
||||
*/
|
||||
const CART_ADDITEM = "cart.addItem";
|
||||
const AFTER_CARTADDITEM = "cart.after.addItem";
|
||||
|
||||
/**
|
||||
* sent when a cart item is modify
|
||||
*/
|
||||
const CART_MODIFYITEM = "cart.modifyItem";
|
||||
const AFTER_CARTCHANGEITEM = "cart.modifyItem";
|
||||
|
||||
/**
|
||||
* sent for addArticle action
|
||||
*/
|
||||
const CART_ADDITEM = "action.addArticle";
|
||||
|
||||
/**
|
||||
* sent on modify article action
|
||||
*/
|
||||
const CART_CHANGEITEM = "action.changeArticle";
|
||||
|
||||
const CART_DELETEITEM = "action.deleteArticle";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user