/**
  * Inject the input filters collection, if any, as an embedded collection
  *
  * @param DoctrineRpcServiceEntity $service
  */
 protected function injectInputFilters(DoctrineRpcServiceEntity $service)
 {
     $inputFilters = $this->inputFilterModel->fetch($this->moduleName, $service->controllerServiceName);
     if (!$inputFilters instanceof InputFilterCollection || !count($inputFilters)) {
         return;
     }
     // @codeCoverageIgnoreStart
     $collection = array();
     foreach ($inputFilters as $inputFilter) {
         $resource = new HalResource($inputFilter, $inputFilter['input_filter_name']);
         $links = $resource->getLinks();
         $links->add(Link::factory(array('rel' => 'self', 'route' => array('name' => 'zf-apigility-admin/api/module/rpc-service/rpc_input_filter', 'params' => array('name' => $this->moduleName, 'controller_service_name' => $service->controllerServiceName, 'input_filter_name' => $inputFilter['input_filter_name'])))));
         $collection[] = $resource;
     }
     $collection = new HalCollection($collection);
     $collection->setCollectionName('input_filter');
     $collection->setCollectionRoute('zf-apigility-admin/module/rpc-service/inputfilter');
     $collection->setCollectionRouteParams(array('name' => $this->moduleName, 'controller_service_name' => $service->controllerServiceName));
     $service->exchangeArray(array('input_filters' => $collection));
 }
示例#2
0
    /**
     * Inject the input filters collection, if any, as an embedded collection
     *
     * @param RpcServiceEntity $service
     */
    protected function injectInputFilters(RpcServiceEntity $service)
    {
        $inputFilters = $this->inputFilterModel->fetch($this->moduleName, $service->controllerServiceName);
        if (!$inputFilters instanceof InputFilterCollection
            || !count($inputFilters)
        ) {
            return;
        }

        $collection = array();
        $parentName = str_replace('\\', '-', $service->controllerServiceName);
        foreach ($inputFilters as $inputFilter) {
            $inputFilter['input_filter_name'] = str_replace('\\', '-', $inputFilter['input_filter_name']);
            $entity   = new HalEntity($inputFilter, $inputFilter['input_filter_name']);
            $links    = $entity->getLinks();
            $links->add(Link::factory(array(
                'rel' => 'self',
                'route' => array(
                    'name' => 'zf-apigility/api/module/rpc-service/input-filter',
                    'params' => array(
                        'name' => $this->moduleName,
                        'controller_service_name' => $parentName,
                        'input_filter_name' => $inputFilter['input_filter_name'],
                    ),
                ),
            )));
            $collection[] = $entity;
        }

        $collection = new HalCollection($collection);
        $collection->setCollectionName('input_filter');
        $collection->setCollectionRoute('zf-apigility/module/rpc-service/input-filter');
        $collection->setCollectionRouteParams(array(
            'name' => $this->moduleName,
            'controller_service_name' => $service->controllerServiceName,
        ));

        $service->exchangeArray(array(
            'input_filters' => $collection,
        ));
    }