Config
Config copied to clipboard
Instantiator not able to resolve __constructor with alone argument
An excpetion was throwed when try to construct an object with only one parameter at constructor and it being a reference to another object.
[productRepository \Develop\Business\Application\Product\Repositories\Product]
__construct = [[databaseConnection]]
PHP Catchable fatal error: Object of class Respect\Config\Instantiator could not be converted to string in /Users/aspinelli/Projects/tonicospinelli/developing-for-business/vendor/respect/config/library/Respect/Config/Container.php on line 310
So, works when I use property name instead of constructor call!
Although there is a bug in the parser here, it will come to a point where we still need to solve an issue with the DSL we are using over INI files: []
is used to detect variables, but they also denote a sequence (e.g: [a]
is variable a
or a sequence containing element a
?).
I was thinking on moving the variable expansion to @name
:
[@db PDO]
dsn = "sqlite::memory:"
[@instanceName From\Class]
__construct[] = [@db]
appendSequence[] = [a]
I would prefer $
, like in PHP, but I am not inclined to make people deal with variable expansion inside PHP scripts while dealing with Config.
Any thoughts against this @Respect/core ?