<?php
namespace OfficeBrain\Bundle\PageBundle\Manager\AbstractManager;

use Symfony\Component\HttpFoundation\Request;

/**
 *
 * @author OfficeBrain 4571 <info@officebrain.com>
 *
 * Description : Abstract Class
 *
 */
abstract class MobileAppAbstract
{
    protected $entityManager;
    protected $request;
    protected $projectSetting;
    protected $instanceId;
    protected $instanceType;
    protected $cultureId;
    protected $cultureCode;
    protected $userId;
    protected $createdUid;
    protected $upatedUid;     
    protected $mobileAppRepository;    
    protected $culture;    
    protected $responseArray;
    protected $homePageSectionId;
    protected $typeArray;
    protected $allowMultipleRecord;    
    /**
     *
     * @author Employee Id: 410175
     * Description : Initialize the required variable on class load
     *
     * @param : null
     *
     * @return null
     *
     * @throws null
     *
     **/
    public function __construct($container, $entityManager, $request)
    {
        $this->entityManager = $entityManager;
        $this->request = $request;
        $this->projectSetting = $this->request->get('project_setting');
        
        if ($this->request->get('instance_id') > 0)
        {
        	$this->projectSetting['instance_id'] = $this->request->get('instance_id');
                $bannerInstance = $this->entityManager->getRepository('OfficeBrainAccessManagementBundle:InstanceMaster')->find($this->request->get('instance_id'));
                $this->projectSetting['instance_type'] = $bannerInstance->getInstanceType();
        }
        
        $this->instanceId = $this->projectSetting['instance_id'];
        $this->instanceType = $this->projectSetting['instance_type'];
        $this->userId = $this->projectSetting['user_id'];
        $this->cultureId = $this->projectSetting['culture_id'];
        $this->cultureCode = $this->projectSetting['culture_code'];
        $this->createdUid = $this->userId;
        $this->upatedUid =$this->userId;
       
        $this->mobileAppRepository  = $this->entityManager->getRepository('OfficeBrainPageBundle:MobileApp');
        
        $this->culture = $this->request->get('_locale');        
        $this->imageBasePath = $container->getParameter('mobile_app.image_url');
        $this->homePageSectionId = $container->getParameter('mobile_app.home_page_setting_section_id');
        $this->typeArray = $container->getParameter('mobile_app.home_page_setting_type');
        $this->responseArray = array();
        $this->allowMultipleRecord = $container->getParameter('mobile_app.home_page_setting_type_allow_multiple');        
    }
        
    /**
     *
     * @author Employee Id: 410175
     * Description : Unset the variables
     *
     * @param : null
     *
     * @return null
     *
     * @throws null
     *
     **/
    public function __destruct()
    {
        unset($this->entityManager);
        unset($this->request);
        unset($this->projectSetting);
        unset($this->instanceId);
        unset($this->instanceType);
        unset($this->userId);
        unset($this->cultureId);
        unset($this->cultureCode);
        unset($this->createdUid);
        unset($this->upatedUid);
        unset($this->mobileAppRepository);
        unset($this->culture);
        unset($this->imageBasePath);
        unset($this->responseArray);
        unset($this->homePageSectionId);
        unset($this->typeArray);
        unset($this->allowMultipleRecord);
    }
    
    public function getHomePageListing()
    {
    }
}
