<?php
namespace OfficeBrain\Bundle\UserBundle\Manager\Extended;

use OfficeBrain\Bundle\UserBundle\Manager\AbstractManager\LoginAbstract;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use OfficeBrain\Bundle\UserBundle\Entity\User;
use OfficeBrain\Bundle\UserBundle\Form\UserType;
use OfficeBrain\Bundle\UserBundle\Service\CustomPasswordEncoder;
use Symfony\Component\Routing\Router;

/**
 *
 * @author Employee Id: 4273
 * OB eCommerce Product - Login
 * LoginExtended Class Add to override the logic for login process
 */

class LoginExtended extends LoginAbstract
{
    private $entityManager;
    protected $session;
    protected $request;

    /**
     * @author Employee Id: 4273
     * Initialize the required variable on class load
     *
    */
    public function __construct($entityManager, $request, $session, $emailService, $router)
    {
        parent::__construct($entityManager, $request, $session, $emailService, $router);
        $this->entityManager = $entityManager;
        $this->session = $session;
        $this->request = $request;
        $this->emailService = $emailService;
        $this->router = $router;
        $this->projectSetting = $this->request->get('project_setting');
        $this->projectUserSetting = $this->request->get('project_user_setting');
        $this->loginConfigrations = $this->projectSetting['configuration_rule']['user']['login'];

        $this->entityManager->getRepository('OfficeBrainUserBundle:SignUpForm')->setProjectSetting($this->projectSetting);
        $this->entityManager->getRepository('OfficeBrainUserBundle:User')->setProjectSetting($this->projectSetting);
        $this->entityManager->getRepository('OfficeBrainUserBundle:User')->setProjectUserSetting($this->projectUserSetting);
    }
}
