I am developing something which I wish to share with people, so I do not wish to write my database password directly into the config file. Instead, I have it in a separate file, which gets merged with the config file. Here are the relevant parts:
app/config/config.php
<?php
$config = new \Phalcon\Config(array(
'database' => array(
'adapter' => 'Mysql',
),
'application' => array(
'controllersDir' => __DIR__ . '/../../app/controllers/',
'modelsDir' => __DIR__ . '/../../app/models/',
'viewsDir' => __DIR__ . '/../../app/views/',
'pluginsDir' => __DIR__ . '/../../app/plugins/',
'libraryDir' => __DIR__ . '/../../app/library/',
'cacheDir' => __DIR__ . '/../../app/cache/',
'baseUri' => '/',
)
));
$localConfigs = require_once __DIR__ . "/config.local.php";
$config->merge($localConfigs);
return ($config);
app/config/config.local.php:
<?php
return(new \Phalcon\Config(
array(
'database' => array(
'host' => 'localhost',
'username' => 'username',
'password' => 'password',
'dbname' => 'database_name'
)
)
));
When I use the generic bootstrap, it works.
When I use the Web Tool, it works -- I can even go to the models tab and see my tables.
When I use the Web Tool's models/create method, it fails with this error dump:
Phalcon\Config\Exception: Configuration must be an Object
#0 /var/www/app/config/config.php(17): Phalcon\Config->merge(true)
#1 /var/phalcon/vendor/phalcon/devtools/scripts/Phalcon/Builder/Component.php(60): include('/var/www/app/co...')
#2 /var/phalcon/vendor/phalcon/devtools/scripts/Phalcon/Builder/Model.php(242): Phalcon\Builder\Component->_getConfig('')
#3 /var/phalcon/vendor/phalcon/devtools/scripts/Phalcon/Web/Tools/controllers/ModelsController.php(66): Phalcon\Builder\Model->build()
#4 [internal function]: ModelsController->createAction()
#5 [internal function]: Phalcon\Dispatcher->dispatch()
#6 /var/phalcon/vendor/phalcon/devtools/scripts/Phalcon/Web/Tools.php(276): Phalcon\Mvc\Application->handle()
#7 /var/www/public/webtools.php(31): Phalcon\Web\Tools::main('/var/phalcon/ve...')
#8 {main}
What is even more odd is if I add die(var_dump($config)); just before the return in config.php, it shows me the config content no problem. But when I remove it, Phalcon thinks I am doing a merge(true) instead of merge($localConfigs).
I am using vagrant to provision a 64bit Wheezy using "Puppetlabs Debian 7.0rc1 x86_64, VBox 4.2.10" box on vagrantbox.es, PHP 5.4 from dotdeb (5.4.16-1dotdeb.1), nginx 1.4.1 from dotdeb (1.4.1-1dotdeb.1), and MariaDB 10 from official (10.0.3+maria-1~wheezy), and Phalcon was build from github master branch on Jun 17.
Any idea what can I do to make Web Tools work properly?