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

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\Translator;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\JsonResponse;

abstract class SettingAbstract
{
    protected $entityManager;
    protected $request;
    
    /**
     * @author Employee Id: 4203
     * OB eCommerce Product - Requestinfo
     * Initialize the required variable on class load
     */
    public function __construct($entityManager, $request, $paginatorManager)
    {
        $this->entityManager = $entityManager;
        $this->request = $request;
        $this->paginatorManager=$paginatorManager;
        $this->settingPageRepositoryManager = $this->entityManager->getRepository('OfficeBrainSettingBundle:Settingpage');
        $this->settingPageRepositoryManager->setPaginatorService($this->paginatorManager);
       
    }
    
    public function __destruct()
    {
        unset($this->entityManager);
        unset($this->request);
        unset($this->settingPageRepositoryManager);
    }
    
    public function  getSettingPageBySlugActive($slug,$status){
        return $this->settingPageRepositoryManager->getSettingPageBySlugActive($slug,$status);
    }

    public function getSettingPageList($page, $recordsPerPage)
    {
        return $this->settingPageRepositoryManager->getSettingPageList($page,$recordsPerPage);
    }
    
    public function saveSettingPage($data, $obj)
    {
        $page= $this->settingPageRepositoryManager->saveSettingPage($data, $obj);
        if ($page) {
            return array('status'=>'SUCCESS');
        }
        return array('status'=>'FAIL');
    }

    public function getSettingPageById($id){
        return $this->settingPageRepositoryManager->getSettingPageById($id);
    }

}