Make `doctrine/dbal` an optional or suggested package

Open
#26 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
backend

Research direction

Review composer.json, services.yaml, OpenConextMonitorBundle.php, and DoctrineConnectionHealthCheck.php to compare the proposed ways of making doctrine/dbal optional. Start by tracing service resource discovery and bundle registration without the package installed. Done means projects without a database no longer install doctrine/dbal and do not encounter autoloading or registration errors.

Written by the indexing model from the issue text.

Description

Currently, when using this bundle, it adds a composer dependency, doctrine/dbal. However, some projects, like stepup-azuremfa, do not use a database.
But the monitor bundle causes doctrine/dbal to be installed in those projects.

This is not really a problem, as the connection is optional in the DoctrineConnectionHealthCheck.

        if ($this->connection === null) {

But it would be nice to not packages without reason.

Possible solution:

  1. Move doctrine/dbal from require to suggest in composer.json.
  2. Exclude DoctrineConnectionHealthCheck.php from resource discovery in services.yaml to prevent autoloading errors?
  3. Conditionally register DoctrineConnectionHealthCheck in OpenConextMonitorBundle.php only if Doctrine\DBAL\Connection exists.
Dominant language
PHP
Stars
7
Forks
2
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenConext/Monitor-bundle

All issues in OpenConext/Monitor-bundle

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.