의존성 주입을 사용하십시오. services.xml 파일에서 관리 서비스를 만들 때 호출해야하는 메서드를 추가 할 수 있습니다.
파일 : ../YourAdminBundle/Resources/config/services.xml :
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<!-- You define the maxpage only once -->
<parameter key="admin_max_per_page_number">10</parameter>
</parameters>
<services>
<service id="xyz_admin" class="Abc\Bundle\YourAdminBundle\Admin\XyzAdmin">
<tag name="sonata.admin" manager_type="orm" group="xyz_group" label="Xyz"/>
<argument />
<argument>Abc\Bundle\YourAdminBundle\Entity\Xyz</argument>
<argument>SonataAdminBundle:CRUD</argument>
<call method="setMaxPerPage">
<argument>%admin_max_per_page_number%</argument>
</call>
</service>
<!-- ... another admin services... -->
</services>
</container>