Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Tdbm Graphql Bundle Laravel Package

thecodingmachine/tdbm-graphql-bundle

A Symfony bundle that integrates the TDBM ORM with GraphQL, helping you expose TDBM entities and repositories as a GraphQL API with less boilerplate. It brings TDBM persistence and GraphQL schema generation together for PHP applications.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install: composer require thecodingmachine/tdbm-graphql-bundle:^6.0. This release aligns the bundle with GraphQLite 6, TDBM 6, and Symfony 6, so confirm your app already runs Symfony 6.x and PHP 8.1+ before upgrading.
  • Register the bundle in config/bundles.php (Flex may do this automatically) and make sure the GraphQLite bundle is registered too — this package sits on top of it and won't provide a schema on its own.
  • Configure two things first: your TDBM connection/bean namespace (the same config you use for standalone TDBM) and your GraphQLite schema/namespace config. If either is missing, you'll get an empty or broken schema with little explanation.
  • Look here first: the bundle's service definitions and its type resolver / query provider classes. These tell you exactly which TDBM beans become GraphQL types and which queries are auto-generated. Reading these two areas saves hours of guessing.
  • First use case: take one existing TDBM bean (e.g. Article), annotate it with GraphQLite's #[Type] / #[Field] attributes, expose a simple query returning it, and confirm it appears in your GraphiQL endpoint. Once that round-trip works, layer on the bundle's auto-generated list/pagination queries.

Implementation Patterns

  • Auto-generated CRUD-ish queries. The bundle's main value is turning TDBM DAOs/beans into GraphQL operations. Rely on the generated find/list queries for straightforward screens rather than hand-writing a resolver per entity.
  • Type resolver for TDBM objects. When a field returns a TDBM bean, let the bundle's type resolver handle the mapping instead of writing a custom TypeMapper per class. Reserve custom resolvers for fields that need joins, aggregation, or non-DAO logic.
  • Attributes over annotations. GraphQLite 6 is attribute-first. Write #[Query], #[Mutation], #[Type], #[Field] on your controllers/beans. This is the pattern your whole codebase should follow after the v6 upgrade.
  • Pagination & filtering. Use the bundle's built-in pagination plumbing (offset/limit inputs) for admin tables and infinite-scroll APIs; it maps cleanly onto TDBM's find with limits. Add explicit filter input types rather than passing raw JSON.
  • Prefetch to kill N+1. TDBM beans are lazy by default. In list queries, use TDBM prefetch/getXxx batch loading (or GraphQLite's buffer/loader patterns) so a list of 50 articles doesn't trigger 50 author queries.
  • Security at field level. Wrap sensitive fields and mutations in GraphQLite's #[Security] / #[Right] attributes. Mutations that write via TDBM should also be validated before save(), not after.
  • Testing. Introspect the schema in a functional test to catch accidental breaking changes (renamed fields, changed nullability) — especially useful right after this major-version bump. Unit-test custom resolvers with mocked DAOs.

Gotchas and Tips

  • v6 is a hard cut, not a soft upgrade. It bumps GraphQLite 6 / TDBM 6 / Symfony 6 simultaneously. If you're on Symfony 4/5 or GraphQLite 5, there is no supported mixed configuration — plan a coordinated upgrade of all three.
  • Docblock annotations are gone. GraphQLite 6 moved to attributes; any legacy @Query / @Type docblocks in your app will silently stop being picked up. Grep your codebase for @Query, @Type, @Field, @Mutation before upgrading.
  • Regenerate TDBM DAOs. TDBM 6 changed its generated code/API. Re-run your TDBM generation step after upgrading, or you'll hit confusing method-signature errors in the bundle's resolvers.
  • Cache-clearing is mandatory. GraphQLite and the bundle cache the schema. After config or attribute changes, php bin/console cache:clear — otherwise you'll debug a schema that no longer matches your code.
  • Empty schema is almost always config. If types are missing, check the bean namespace and the GraphQLite namespace config first; the bundle fails quietly rather than throwing.
  • N+1 is the #1 performance trap. Default lazy loading on TDBM relations looks fine in development and collapses under real list queries. Prefetch in the query provider or use a dataloader, and profile with a query counter.
  • Extension points worth knowing: custom type mappers/resolvers for value objects, custom query providers when the generated queries don't fit, and GraphQLite middleware for auth/logging. Prefer these over forking the bundle.
  • Debugging: enable GraphiQL in the dev environment for fast iteration; for resolver errors, check the GraphQLite error handler config — production often masks the underlying exception, which makes debugging harder than it needs to be.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource