Prompt
Maintain consistency and clarity in database-related parameters and configuration variables. Follow these practices:
- Use descriptive variable names that match parameter names for clarity
- Follow established naming patterns for database configuration
- Use ‘enabled’/’disabled’ instead of boolean values for configuration flags
- Avoid unnecessary complexity in database parameter handling
Example 1 - Simplifying parameter handling:
// Instead of:
$dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : 'postgresql';
// Use:
$database = $this->getParam('database', 'mariadb');
Example 2 - Consistent naming for database configuration flags:
// Instead of:
_APP_SLOW_QUERIES=true
// Use:
_APP_SLOW_QUERIES_BLOCK=enabled
These practices improve code readability, maintainability, and reduce the potential for errors in database-related code.