Skip to content

fix(database-mysql): Added missing QueryBuilderFactoryInterface implementation#7

Merged
markshust merged 2 commits intomarko-php:developfrom
teunissenstefan:fix/add-factory-implementation
Apr 5, 2026
Merged

fix(database-mysql): Added missing QueryBuilderFactoryInterface implementation#7
markshust merged 2 commits intomarko-php:developfrom
teunissenstefan:fix/add-factory-implementation

Conversation

@teunissenstefan
Copy link
Copy Markdown
Contributor

@teunissenstefan teunissenstefan commented Apr 2, 2026

Summary

Adds the missing QueryBuilderFactoryInterface implementation to the marko/database-mysql package.

The Repository base class depends on QueryBuilderFactoryInterface, even though it says it's optional (vendor/marko/database/src/Repository/Repository.php:50). While this dependency is marked as optional in the constructor, it becomes required when calling query(). Without this implementation, repositories extending Repository and using custom queries throw NoDriverException::noDriverInstalled when the DI container attempts to bind the dependency.

This PR adds:

  • MySqlQueryBuilderFactory class implementing QueryBuilderFactoryInterface
  • Binding in module.php

Related commit where this was done for pgSQL, but not MySQL: 2e530f02

Additional changes (maintainer)

  • Rebased onto current develop
  • Added unit tests for MySqlQueryBuilderFactory (creation, instance independence, interface compliance)
  • Added module binding test for the new QueryBuilderFactoryInterface entry in ModuleBindingsTest.php
  • Removed unnecessary self-namespace import (use Marko\Database\MySql\Query\MySqlQueryBuilder) from the factory class

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Docs
  • Refactor

Checklist

  • Tests pass (./vendor/bin/pest --parallel)
  • Lint passes (./vendor/bin/phpcs)
  • Follows code standards

@github-actions github-actions bot added bug Something isn't working breaking Introduces a breaking change labels Apr 2, 2026
teunissenstefan and others added 2 commits April 4, 2026 23:45
…import

Add unit tests for MySqlQueryBuilderFactory (creation, independence,
interface compliance) and a module binding test for the new
QueryBuilderFactoryInterface entry. Remove unnecessary self-namespace
import in the factory class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@markshust markshust force-pushed the fix/add-factory-implementation branch from 42a9db3 to 76b0395 Compare April 5, 2026 03:49
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 5, 2026
@markshust markshust merged commit 8e81694 into marko-php:develop Apr 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces a breaking change bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants