# \Thelia\ActionCart

Class Cart where all actions are manage like adding, modifying or delete items.

Class Cart

## Summary

Methods
Properties
Constants
__construct()
addArticle()
deleteArticle()
modifyArticle()
getSubscribedEvents()
No public properties found
No constants found
updateQuantity()
addItem()
findItem()
validateForm()
propagateFormError()
redirect()
$dispatcher
N/A
getAddCartForm()
No private properties found
N/A

File
  Action/Cart.php
Package
  \Thelia\Action
Class hierarchy
  \Thelia\Action\BaseAction
  \Thelia\Action\Cart

## Tags

None found

## Properties

### $dispatcher

    $dispatcher : \Symfony\Component\EventDispatcher\EventDispatcherInterface

#### Type

\Symfony\Component\EventDispatcher\EventDispatcherInterface

#

## Tags

None found

## Methods

### __construct()

    __construct(\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher)

#### Parameters

\Symfony\Component\EventDispatcher\EventDispatcherInterface | $dispatcher |

#

## Tags

None found

### addArticle()

    addArticle(\Thelia\Core\Event\ActionEvent $event)

add an article to cart

#### Parameters

\Thelia\Core\Event\ActionEvent | $event |

#

## Tags

None found

### deleteArticle()

    deleteArticle(\Thelia\Core\Event\ActionEvent $event)

Delete specify article present into cart

#### Parameters

\Thelia\Core\Event\ActionEvent | $event |

#

## Tags

None found

### modifyArticle()

    modifyArticle(\Thelia\Core\Event\ActionEvent $event)

Modify article's quantity

don't use Form here just test the Request.

#### Parameters

\Thelia\Core\Event\ActionEvent | $event |

#

## Tags

None found

### getSubscribedEvents()

    getSubscribedEvents() : array

Returns an array of event names this subscriber wants to listen to.

The array keys are event names and the value can be:

- The method name to call (priority defaults to 0)
- An array composed of the method name to call and the priority
- An array of arrays composed of the method names to call and respective priorities, or 0 if unset

For instance:

- array('eventName' => 'methodName')
- array('eventName' => array('methodName', $priority))
- array('eventName' => array(array('methodName1', $priority), array('methodName2'))

#### Returns

array —

The event names to listen to

#

static

## Tags

api |

### updateQuantity()

    updateQuantity(\Thelia\Model\CartItem $cartItem,  $quantity)

#### Parameters

\Thelia\Model\CartItem | $cartItem |
| $quantity |

#

## Tags

None found

### addItem()

    addItem(\Thelia\Model\Cart $cart,  $productId,  $productSaleElementsId,  $quantity, \Thelia\Model\ProductPrice $productPrice)

#### Parameters

\Thelia\Model\Cart | $cart |
| $productId |
| $productSaleElementsId |
| $quantity |
\Thelia\Model\ProductPrice | $productPrice |

#

## Tags

None found

### findItem()

    findItem( $cartId,  $productId,  $productSaleElementsId)

#### Parameters

| $cartId |
| $productId |
| $productSaleElementsId |

#

## Tags

None found

### validateForm()

    validateForm(\Thelia\Form\BaseForm $aBaseForm,  $expectedMethod)

#### Parameters

\Thelia\Form\BaseForm | $aBaseForm |
| $expectedMethod |

#

Inherited from
  \Thelia\Action\BaseAction

## Tags

None found

### propagateFormError()

    propagateFormError(\Thelia\Form\BaseForm $aBaseForm, string $error_message, \Thelia\Core\Event\ActionEvent $event)

#### Parameters

\Thelia\Form\BaseForm | $aBaseForm |
string | $error_message |
\Thelia\Core\Event\ActionEvent | $event |

#

Inherited from
  \Thelia\Action\BaseAction

## Tags

None found

### redirect()

    redirect( $url,  $status)

#### Parameters

| $url |
| $status |

#

Inherited from
  \Thelia\Action\BaseAction

## Tags

None found

### getAddCartForm()

    getAddCartForm(\Symfony\Component\HttpFoundation\Request $request)

#### Parameters

\Symfony\Component\HttpFoundation\Request | $request |

#

## Tags

None found

### Cart.php