# Sonata\MediaBundle/Resources/config/admin.yml
services:
sonata.admin.post:
class: Sonata\MediaBundle\Admin\MediaAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "Content", label: "Post" }
arguments:
- ~
- Sonata\MediaBundle\Entity\Media
- ~
- Sonata\MediaBundle\Provider\Pool //??????????????
calls:
- [ setTranslationDomain, [Sonata\MediaBundle]]
如果执行此服务,则出现错误:
Catchable Fatal Error: Argument 4 passed to Sonata\MediaBundle\Admin\BaseMediaAdmin::__construct() must be an instance of Sonata\MediaBundle\Provider\Pool, none given, called in C:\server\fs\app\cache\dev\appDevDebugProjectContainer.php on line 1535 and defined in C:\server\fs\vendor\bundles\Sonata\MediaBundle\Admin\BaseMediaAdmin.php line 34
因为 4 参数是字符串而不是对象。
/**
* @param string $code
* @param string $class
* @param string $baseControllerName
* @param \Sonata\MediaBundle\Provider\Pool $pool
*/
public function __construct($code, $class, $baseControllerName, Pool $pool)
{
parent::__construct($code, $class, $baseControllerName);
$this->pool = $pool;
}
我如何通过此服务传递对象?