Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Respect existing config.php and local.php #166

Open
dkmuir opened this issue Jun 8, 2016 · 5 comments
Open

Respect existing config.php and local.php #166

dkmuir opened this issue Jun 8, 2016 · 5 comments
Labels

Comments

@dkmuir
Copy link

dkmuir commented Jun 8, 2016

Apigility should write to its own config files rather than rewriting existing files.
We've had to move the application's config out of global.php and into app.global.php because Apigility kept messing it up each time a change was made in the admin ui.
Eg. closures would break, and constants were being replaced with their values.

@TomHAnderson
Copy link

This is just my opinion, not that of Apigility.

You should never use closures in your config files and you should never use constants outside very specific-use classes.

The problems you listed are not because Apigility uses the expected global.php file and it doesn't modify the local.php file. These problems are because you're using config files wrong.

For anything which requires a fixture put it in the service manager config of the module. For anything that requires a constant drag the developer out by his hair.

@dkmuir
Copy link
Author

dkmuir commented Jun 8, 2016

local.php was modified to include zf-mvc-auth.
I agree that closures are not the best in config files (eg, breaks caching the merged file), so we're converting those into factories.
I completely disagree with your opinion of constants.
Which would you rather see?

'error_reporting' => 32767,
...
'driver_options' => array(
    1002 => 'SET NAMES \'UTF8\''
),
...
'curloptions' => array(
    64 => true,
),

or:

'error_reporting' => E_ALL,
...
'driver_options' => array(
    PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),
...
'curloptions' => array(
    CURLOPT_SSL_VERIFYPEER => true,
),

@TomHAnderson
Copy link

$serviceManager->get('doctrine.entitymanager.orm_default');

@TomHAnderson
Copy link

For error reporting that should be a function in local.php set_error_reporting and it should use the PHP E_ALL constant. My previous comment I hope shows my ignorance of PDO. I think you have a point about Apigility changing local.php.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools; a new issue has been opened at laminas-api-tools/api-tools#25.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants