Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

config:报 DatabaseAdapter 实例化时参数错误 #1

Closed
li914 opened this issue Feb 15, 2022 · 20 comments
Closed

config:报 DatabaseAdapter 实例化时参数错误 #1

li914 opened this issue Feb 15, 2022 · 20 comments
Labels

Comments

@li914
Copy link

li914 commented Feb 15, 2022

大佬,window系统下,报错误
ArgumentCountError: Too few arguments to function Tinywan\Casbin\Adapter\DatabaseAdapter::__construct(), 0 passed in G:\workerman\demo\vendor\workerman\webman-framework\src\Container.php on line 30 and exactly 1 expected in G:\work
erman\demo\vendor\tinywan\casbin\src\Adapter\DatabaseAdapter.php:50
说是参数过多,配置都没有修改,表也建好了

@Tinywan
Copy link
Owner

Tinywan commented Feb 15, 2022

你DI没配置

image

@li914
Copy link
Author

li914 commented Feb 15, 2022

呃呃呃 这样子啊 谢谢大佬

@Tinywan
Copy link
Owner

Tinywan commented Feb 15, 2022

@li914 问题解决了没有?

@Tinywan Tinywan changed the title 报 DatabaseAdapter 实例化时参数错误 #config:报 DatabaseAdapter 实例化时参数错误 Feb 15, 2022
@Tinywan Tinywan changed the title #config:报 DatabaseAdapter 实例化时参数错误 config:报 DatabaseAdapter 实例化时参数错误 Feb 15, 2022
@li914
Copy link
Author

li914 commented Feb 15, 2022

这个依赖注入好像会影响 webman/gateway-worker 这个插件,使用这个依赖注入就无法运行 webman/gateway-worker

@li914
Copy link
Author

li914 commented Feb 15, 2022

webman/gateway-worker 不启用这个插件,可以正常使用

@Tinywan Tinywan added the config label Feb 15, 2022
@Tinywan
Copy link
Owner

Tinywan commented Feb 15, 2022

使用 webman/gateway-worker 这个插件报错是什么?这个插件是群主今天刚开发的,可能有问题

@li914
Copy link
Author

li914 commented Feb 15, 2022

``DI\Definition\Exception\InvalidDefinition: Entry "Webman\GatewayWorker\BusinessWorker" cannot be resolved: Parameter $config of __construct() has no value defined or guessable
Full definition:
Object (
class = Webman\GatewayWorker\BusinessWorker
lazy = false
__construct(
$config = #UNDEFINED#
)
) in G:\workerman\midou\vendor\php-di\php-di\src\Definition\Exception\InvalidDefinition.php:19
Stack trace:
#0 G:\workerman\midou\vendor\php-di\php-di\src\Definition\Resolver\ObjectCreator.php(156): DI\Definition\Exception\InvalidDefinition::create(Object(DI\Definition\ObjectDefinition), 'Entry "Webman\G...')
#1 G:\workerman\midou\vendor\php-di\php-di\src\Definition\Resolver\ObjectCreator.php(71): DI\Definition\Resolver\ObjectCreator->createInstance(Object(DI\Definition\ObjectDefinition), Array)
#2 G:\workerman\midou\vendor\php-di\php-di\src\Definition\Resolver\ResolverDispatcher.php(71): DI\Definition\Resolver\ObjectCreator->resolve(Object(DI\Definition\ObjectDefinition), Array)
#3 G:\workerman\midou\vendor\php-di\php-di\src\Container.php(390): DI\Definition\Resolver\ResolverDispatcher->resolve(Object(DI\Definition\ObjectDefinition), Array)

@li914
Copy link
Author

li914 commented Feb 15, 2022

这是截取的一部分错误信息,两者分开使用就没有问题的,正常运行

@Tinywan
Copy link
Owner

Tinywan commented Feb 15, 2022

那这个问题你给群主反馈一下,依赖自动注入 和插件本来就是分开,没有关系的

@li914
Copy link
Author

li914 commented Feb 15, 2022

好的

@Tinywan
Copy link
Owner

Tinywan commented Feb 15, 2022

@li914 群主答复了

image

@li914
Copy link
Author

li914 commented Feb 15, 2022

看见了,谢谢大佬

@li914 li914 closed this as completed Feb 15, 2022
@li914 li914 reopened this Feb 24, 2022
@li914
Copy link
Author

li914 commented Feb 24, 2022

大佬,这个遇到一个问题,当 [webman/console 命令行插件] 插件时,无法同时使用,会报错误

微信截图_20220224120950

当关闭这个权限控制插件, [webman/console 命令行插件] 可以正常使用

系统:windows7
PHP版本:7.3
webman版本:1.2.4

@Tinywan
Copy link
Owner

Tinywan commented Feb 24, 2022

webman/console 版本号是多少?

@li914
Copy link
Author

li914 commented Feb 24, 2022

webman/console 版本号是多少?

1.0.6

@Tinywan
Copy link
Owner

Tinywan commented Feb 24, 2022

不要使用Windows,本地开发请使用Docker或者虚拟机

@li914
Copy link
Author

li914 commented Feb 24, 2022

开发啊
嗯嗯 谢谢了

@li914 li914 closed this as completed Feb 24, 2022
@Tinywan
Copy link
Owner

Tinywan commented Feb 24, 2022

You can't install ext-pcntl extension on Windows. Accordingly to the PHP documentation:

@li914
Copy link
Author

li914 commented Feb 24, 2022

image

已解决,在 support/bootstrap.php 文件中,给 $class_name::start($worker); 添加判断条件 if ($worker){ $class_name::start($worker); }

@Tinywan
Copy link
Owner

Tinywan commented Feb 24, 2022

@li914 最新版本已经解决这个问题了,使用最新版本 v0.0.8,尽量不要改动框架源码哦!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants