<?php
namespace Application\Service\DB\Admin;

use Interop\Container\ContainerInterface;

class Rolemenurelation extends \Application\Service\DB\AbstractDb
{
    public function __construct($dbAdapter, ContainerInterface $container)
    {
        $this->tableName = 'yikeen_admin_rolemenurelation';
        parent::__construct($dbAdapter, $container);
    }

    public function getAdminRoleMenuData($whereData=[],$type = 0,$field=''){
        $data = [];
        switch ($type){
            case 1:
                $data = $this->LocalService()->roleMenuRelation->fetchAll($whereData);
//                !is_array($data) && $data = [];
                break;
            case 2:
                $data = $this->LocalService()->roleMenuRelation->fetchOne($whereData);
                break;
            case 3:
                $data = $this->LocalService()->roleMenuRelation->fetchCol($field,$whereData);
                break;
            default:
                $data['data'] = $this->LocalService()->roleMenuRelation->fetchAll($whereData);
                $data['count'] = $this->LocalService()->roleMenuRelation->getCount($whereData['where']);
                break;
        }
        return $data ;
    }
}