## Install
Register the bundle in your kernel :

```PHP
// app/AppKernel.php

new Edeclic\PrestashopBridgeBundle\EdeclicPrestashopBridgeBundle(),
```

## Config

##### Base configuration

```YAML
# App/config/config.yml

edeclic_prestashop_bridge:
    prestashop:
        cookie_key: "%prestashop_key%"
        presta_path: "%prestashop_path%"
        shop_id: %prestashop_id%
        avoid_mode: %prestashop_avoid%
 
        
# App/config/parameters.yml

        prestashop_key: COOKIE_KEY
        prestashop_path: PATH
        prestashop_id: 1
        prestashop_avoid: false
```
##### Logout Configuration

```YAML
# App/config/security.yml

security:
    firewalls:
        main:
            logout:
                handlers: ['edeclic.prestashop.logout']
```

## How does it works ?

When a user log or register in Symfony, this bundle check if the user exist
in Prestashop, create the user in Prestashop if needed and then log the user 
with a cookie.

For register and login, the bundle use an eventSubscriber with the following events:

```
FOSUserEvents::REGISTRATION_CONFIRMED 
FOSUserEvents::SECURITY_IMPLICIT_LOGIN 
SecurityEvents::INTERACTIVE_LOGIN
```

For logout, it's an implementation of LogoutHandlerInterface :

```PHP
class LogoutListener implements LogoutHandlerInterface
{
//content [...]
}
```

## Avoid Mode
Set it to true to enable "avoid mode"
```YAML
App/config/parameters.yml
        #[...]
        prestashop_avoid: true
```
It permit to avoid performing action in prestashop when login/update user.