<?php

namespace Application\Service\DB\Project;

use Interop\Container\ContainerInterface;

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

    public function getAllGroupType(){
        $where['where']  = 'is_del = 0';
        $where['columns']  = ['id', 'type', 'name', 'code'];
        $datas = $this->LocalService()->dictionarySetocrfield->fetchAll($where);
        $result = [];
        if(!empty($datas)){
            foreach($datas as &$data){
                $type = $data['type'];
                $name = $data['name'];
                $code = $data['code'];
                $result[$type][$name] = $code;
            }
        }
        unset($datas);
        return $result;
    }

}