Tinywan / webman-casbin

An authorization library that supports access control models like ACL, RBAC, ABAC for webman plugin
https://www.workerman.net/webman
Apache License 2.0
11 stars 0 forks source link

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

Closed li914 closed 2 years ago

li914 commented 2 years ago

大佬,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 commented 2 years ago

你DI没配置

image

li914 commented 2 years ago

呃呃呃 这样子啊 谢谢大佬

Tinywan commented 2 years ago

@li914 问题解决了没有?

li914 commented 2 years ago

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

li914 commented 2 years ago

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

Tinywan commented 2 years ago

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

li914 commented 2 years ago

``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 commented 2 years ago

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

Tinywan commented 2 years ago

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

li914 commented 2 years ago

好的

Tinywan commented 2 years ago

@li914 群主答复了

image

li914 commented 2 years ago

看见了,谢谢大佬

li914 commented 2 years ago

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

微信截图_20220224120950

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

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

Tinywan commented 2 years ago

webman/console 版本号是多少?

li914 commented 2 years ago

webman/console 版本号是多少?

1.0.6

Tinywan commented 2 years ago

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

li914 commented 2 years ago

开发啊
嗯嗯 谢谢了

Tinywan commented 2 years ago

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

li914 commented 2 years ago

image

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

Tinywan commented 2 years ago

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