[英]how can create other conection zf2 apigility?
How can create a connection to my data/database.db I get this connection only with one config but don't from another config in the same file module.php
如何创建与我的data / database.db的连接我只能通过一个配置获得此连接,而不能从同一文件
module.php
中的另一个配置获得此连接
In this code it's ok 在这段代码中没关系
public function getServiceConfig()
{
return array(
'factories' => array(
'Music\V1\Rest\Album\AlbumMapper' => function ($sm) {
$adapter = $sm->get('Zend\Db\Adapter\Adapter');
return new \Music\V1\Rest\Album\AlbumMapper($adapter);
},
),
);
}
But if I try with two connection doesn't work: 但是,如果我尝试两个连接不起作用:
public function getServiceConfig()
{
return array(
'factories' => array(
'Music\V1\Rest\Album\AlbumMapper' => function ($sm) {
$adapter = $sm->get('Zend\Db\Adapter\Adapter');
return new \Music\V1\Rest\Album\AlbumMapper($adapter);
},
'Music\V1\Rest\Albumjson\AlbumjsonMapper' => function ($sm) {
$adapter = $sm->get('Zend\Db\Adapter\Adapter');
return new \Music\V1\Rest\Albumjson\AlbumjsonMapper($adapter);
},
),
);
}
I get the next error with zf2 : 我收到zf2的下一个错误 :
An abstract factory could not create an instance of musicv1restalbumjsoncontroller(alias:
Music\\\\V1\\\\Rest\\\\Albumjson\\\\Controller
).抽象工厂无法创建musicv1restalbumjsoncontroller的实例(别名:
Music\\\\V1\\\\Rest\\\\Albumjson\\\\Controller
)。
The error has nothing to do with your database setup. 该错误与您的数据库设置无关。 It means your controller class cannot be found.
这意味着找不到您的控制器类。 Did you properly register a controller called
Music\\\\V1\\\\Rest\\\\Albumjson\\\\Controller
? 您是否正确注册了一个名为
Music\\\\V1\\\\Rest\\\\Albumjson\\\\Controller
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.