-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency Injection for classes with array constructor parameter fails #10231
Comments
Do you have an example of the code that you use? |
Yes I do. Please give me a couple of days though as I’m on holidays right now. |
So back to work... You can check out the app in: Note that it is by no means a complete app yet, I'm still learning... The class you are looking for is the OrganisationMapper that tries to load a list of organisations from the database upon startup. So just open the app and you should see the errors mentioned above. |
Use "make all" to build after cloning |
So I guess this issue can be closed. Could be reopened if there are classes part of the public interface that show the same behavior (I don’t know any though) |
I just noticed that injecting classes with array parameters fails as the SimpleContainer tries to resolve the variable name as a class which will usually fail. On the screenshot you can see the problem when trying to inject an OC\DB\Connection into a mapper:
Moreover the log file only shows me an error that my service class is not found however the problem lies much deeper (service -> mapper -> OC\DB\Connection <-- Throws Exception) which makes it really hard to realize what the problem really is.
Steps to reproduce
Expected behaviour
Probably it should try to create an instance with an empty array and create the mapper. Or probably the Connection class should not use arrays in the constructor in the first place.
Actual behaviour
Nextcloud fails to create an instance of your controller/service/mapper
Server configuration
Operating system:
Ubuntu 18.04
Web server:
Apache2
Database:
SQLite (Development machine)
PHP version:
7.1
Nextcloud version: (see Nextcloud admin page)
14
Updated from an older Nextcloud/ownCloud or fresh install:
Fresh install
Where did you install Nextcloud from:
Github
List of activated apps:
App list
Nextcloud configuration:
Config report
Are you using external storage, if yes which one: local/smb/sftp/...
No
Are you using encryption: yes/no
No
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
No
Client configuration
Browser:
Chrome 67.0.3396.99
Operating system:
Windows 10
Logs
Web server error log
Web server error log
Nextcloud log (data/nextcloud.log)
Nextcloud log
Browser log
Browser log
The text was updated successfully, but these errors were encountered: