<?php

namespace OfficeBrain\Bundle\PageBundle\Entity;

/**
 * MobileAppRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class MobileAppRepository extends \Doctrine\ORM\EntityRepository
{
 	/**
     * @author Employee Id: 410175
     *
     * Description : Get All the Setting 
     *
     * @return record set
     *
     **/
    public function getHomePageListing($homePageSection,$countryId=null)
    {
    	$homePageSection = (int)$homePageSection;
        $query = $this->createQueryBuilder('ms')
            ->select('ms.id,ms.title,ms.image,ms.type,ms.sortPosition,ms.mobileAppSetting,ms.countryId')            
            ->where('ms.deletedAt IS NULL');
    	if ($countryId!=null) {
            $query->andwhere('ms.countryId = :countryId');
            $query->setParameter('countryId', $countryId);
        }	            
            $query->andWhere('ms.section = :section')->setParameter('section', $homePageSection)
            ->orderBy('ms.type,ms.sortPosition');
            
       return $query->getQuery()->getArrayResult();
    }
}