简体   繁体   English

如何创建其他连接zf2适应性?

[英]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.

相关问题 ZF2 apigility - 我们如何验证json数据中的集合 - ZF2 apigility - How can we validate collections in json data 如何在现有的ZF2应用程序中使用Apigility? - How to use Apigility with an existing ZF2 application? 如何解决致命错误:在ZF2 Apigility中找不到资源未捕获的异常? - How can I resolve Fatal Error:Uncaught exception with Resource not found in ZF2 Apigility? ZF2:我可以将文本框附加到multicheckbox吗? 如何使用MultiCheckbox或ZF2中的复选框组创建“其他”或“注释”之类的文本框字段? - ZF2: Can i attach textbox to multicheckbox ? How to create textbox field like “Other” or “Comment” with MultiCheckbox or group of checkboxes in ZF2? 如何为具有多个版本的Apigility ZF2应用程序设置PHPUnit? - How to set up PHPUnit for an Apigility ZF2 application with multiple versions? ZF2,具有原则和嵌入式Atributes的适应性问题 - ZF2, Apigility with Doctrine and Embedded Atributes issue ZF2 +适应性+ Oauth2单元测试 - ZF2 + Apigility + Oauth2 Unit testing 无法使用zf2在apigility中使用ApiProblemListner - Unable to use ApiProblemListner in apigility using zf2 如何在ZF2的控制台控制器中创建URL? - How can I create a URL in a Console Controller in ZF2? 如果规则取决于字段,如何在ZF2 / Apigility中设置输入验证? - How to set up input validation in ZF2/Apigility, if rules are field-dependent?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM