1
我目前使用FOSCommentBundle获得REST API的最佳实践的Symfony:私人服务 - 利用休息-API
在这个包的样品例如有使用分拣机(或排序)服务使用不同的选项提供更改选项,与日递增和日期倒序排序,但这个服务不是由“页码”或“日期”范围排序提供商阵列(排序类服务中)在奥得河页面的方式这
重用注入
parameters:
# The sorting factory class
cms_content.sorting_factory.class: CMS\Bundle\ContentBundle\Sorting\SortingFactory
# Provide to sort by date
cms_content.sorter.date.class: CMS\Bundle\ContentBundle\Sorting\DateSorting
# Provide to sort by page number
cms_content.sorter.page_nb.class: CMS\Bundle\ContentBundle\Sorting\PageNbSorting
#
sorter_sevices_aliases:
- 'cms_content.sorter.page_nb_desc'
- 'cms_content.sorter.page_nb_asc'
- 'cms_content.sorter.date_desc'
- 'cms_content.sorter.date_asc'
services:
# sort by page nb asc
cms_content.sorter.page_nb_asc:
class: '%cms_content.sorter.page_nb.class%'
public: false
tags:
- { name: cms_content.sorter, alias: page_nb_asc }
arguments: [ASC]
# sort by page nb dsc
cms_content.sorter.page_nb_desc:
class: '%cms_content.sorter.page_nb.class%'
public: false
tags:
- { name: cms_content.sorter, alias: page_nb_desc }
arguments: [DESC]
# sort by date asc
cms_content.sorter.date_asc:
class: '%cms_content.sorter.date.class%'
public: false
tags:
- { name: cms_content.sorter, alias: date_asc }
arguments: [ASC]
# sort by date desc
cms_content.sorter.date_desc:
class: '%cms_content.sorter.date.class%'
public: false
tags:
- { name: cms_content.sorter, alias: date_desc }
arguments: [DESC]
# the sorting factory (may be construct with empty array)
cms_content.sorting_factory:
class: '%cms_content.sorting_factory.class%'
arguments: ['%sorter_sevices_aliases%', '%cms_content.sorting_factory.default_sorter%']
我哈哈已经有些麻烦使用声明为private服务分拣工厂内尽可能选机供应商的阵列