If I use the "Phalcon\Config\Adapter\Yaml" class from the incubator as described in the readme:
define('APPROOT', dirname(__DIR__));
define('CONFKEY', 'secret');
$config = new Phalcon\Config\Adapter\Yaml('path/config.yml', array(
'!decrypt' => function($value) {
return (new Phalcon\Crypt)->setCipher('blowfish')->decryptBase64($value, CONFKEY);
},
'!approot' => function($value) {
return APPROOT . $value;
}
));
echo $config->phalcon->controllersDir;
echo $config->database->username;
echo $config->database->password;
I am getting an error:
BadMethodCallException: Wrong number of parameters
Stack trace:
#0 Phalcon\Config\Adapter\Yaml->__construct(/usr/share/nginx/phalcon-services/config/config.yml, Array([!decrypt] => Object(Closure), [!approot] => Object(Closure)))
However, if instead I manually load the yml file in an array $result and then pass it to a Phalcon\Config constructor, everything works (basically, do the same thing that the adapter does in my index.php inside the public folder).
Also, if I dump the callbacks array, it works as well but obviously without having the values processed by the closure functions. I am not sure why I get that exception when I pass the closures to the adapter.
I am using:
PHP Version 5.4.4-14+deb7u14 YAML module 1.1.1 Phalcon 1.3.2
Could someone help me?
Thanks!