Skip to content

Migrate Twig namespace registration to Symfony 7+ auto-discovery#6

Merged
peldax merged 4 commits intomainfrom
copilot/refactor-template-structure
Jan 13, 2026
Merged

Migrate Twig namespace registration to Symfony 7+ auto-discovery#6
peldax merged 4 commits intomainfrom
copilot/refactor-template-structure

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

The bundle's manual Twig namespace registration via PrependExtensionInterface fails in Symfony 7.3+/8.0 with "There are no registered paths for namespace 'Graphpinator'". Symfony 7+ automatically discovers bundle templates when using AbstractBundle with proper directory structure.

Changes

Template structure modernization

  • Move src/Resources/views/*.twigtemplates/*.twig
  • Delete src/Resources/ directory

Bundle simplification

  • Remove getContainerExtension() override in GraphpinatorBundle
  • Delete src/DependencyInjection/GraphpinatorExtension.php (35 lines)
  • Keep only getPath() method returning \dirname(__DIR__)

Test updates

  • Remove GraphpinatorExtensionTest.php (tested deleted code)
  • Update GraphpinatorBundleTest.php (remove extension tests)
  • Add tests/Integration/TwigNamespaceTest.php verifying namespace auto-registration

Dependencies

  • Add symfony/twig-bundle: ^7.3 || ^8.0 to dev requirements

How it works

final class GraphpinatorBundle extends AbstractBundle
{
    public function getPath(): string
    {
        return \dirname(__DIR__); // Symfony discovers templates/ automatically
    }
}

Symfony 7+ calls getPath(), finds templates/ at that location, and registers @Graphpinator namespace without configuration. Controllers using @Graphpinator/ui.html.twig work unchanged.

Net: -127 lines, +150 lines (mostly comprehensive integration test)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/OndraM/ci-detector/zipball/8b0223b5ed235fd377c75fdd1bfcad05c0f168b8
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0525c73950de35ded110cffafb9892946d7771b5
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/845eb62303d2ca9b289ef216356568ccc075ffd1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/colinodell/json5/zipball/5724d21bc5c910c2560af1b8915f0cc0163579c8
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator-common/zipball/fbe087fb00cdd023b3c584cd6bf403c77d0fd5be
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator-constraint-directives/zipball/26a479c702a2b2a29893bc2af04ef5ba3aa51cdc
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator-parser/zipball/95f03d4ca204e769f31e5c0a50a4bc246848386e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator-persisted-queries/zipball/97470e281d396d925105ce07e63f21d2a1771213
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator-printer/zipball/99450230e8e09c0e9176d08222541fe62e607f44
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator-source/zipball/657532e333ca5b567611c1e12581f563544c15f1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator-tokenizer/zipball/315ebecf3aa6199960883e36e7d9b49011a9e611
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator-upload/zipball/e88aad18c0843192e6240de5e48cb8ebe8916277
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/graphpinator/zipball/e8283f02aef82e8673f10029e20611ee6923e2e0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/graphpql/utils/zipball/88d67d3f86013d9a1e1694f21444235e489af005
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/infection/abstract-testframework-adapter/zipball/18925e20d15d1a5995bb85c9dc09e8751e1e069b
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/infection/extension-installer/zipball/9b351d2910b9a23ab4815542e93d541e0ca0cdcf
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/infection/include-interceptor/zipball/0cc76d95a79d9832d74e74492b0a30139904bdf7
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/infection/infection/zipball/feea2a48a8aeedd3a4d2105167b41a46f0e568a3
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/infection/mutator/zipball/3c976d721b02b32f851ee4e15d553ef1e9186d1d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/jsonrainbow/json-schema/zipball/2eeb75d21cf73211335888e7f5e6fd7440723ec7
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/marc-mabe/php-enum/zipball/bb426fcdd65c60fb3638ef741e8782508fda7eef
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpdoc-parser/zipball/16dbf9937da8d4528ceb2145c9c7c0bd29e26374
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/468e02c9176891cc901143da118f09dc9505fc2f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/d6211c46213d4181054b3d77b10a5c5cb0d59538
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan-symfony/zipball/24d8c157aa483141b0579d705ef0aac9e1b95436
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sanmai/later/zipball/72a82d783864bca90412d8a26c1878f8981fee97
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sanmai/pipeline/zipball/fb8d0c23b4ef085315a36d397fafa052203020ce
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/comparator/zipball/e8e53097718d2b53cfb2aa859b06a41abf58c62e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/exporter/zipball/0735b90f4da94969541dac1da743446e276defa6
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f2e26f52f80ef77832e359205f216eeac00e320c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/47e34210757a2f37a97dcd207d032e1b01e64c7a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/shipmonk-rnd/composer-dependency-analyser/zipball/975e5873b519d5180b1017a5dfb43d80781abd45
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/slevomat/coding-standard/zipball/d247cdc04b91956bdcfaa0b1313c01960b189d3c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/cache-contracts/zipball/5d68a57d66910405e5c0b63d6f0af941e66fc868
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/cache/zipball/fae016390a2e6b451abc0f4805cbfe0bf70f437f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/config/zipball/800ce889e358a53a9678b3212b0c8cecd8c6aace
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/console/zipball/732a9ca6cd9dfd940c639062d5edbde2f6727fb6
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/dependency-injection/zipball/54122901b6d772e94f1e71a75e0533bc16563499
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/error-handler/zipball/48be2b0653594eea32dcef130cca1c811dcf25c2
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/event-dispatcher/zipball/9dddcddff1ef974ad87b3708e4b442dc38b2261d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/filesystem/zipball/d551b38811096d0be9c4691d406991b47c0c630a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/finder/zipball/fffe05569336549b20a1be64250b40516d6e8d06
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/framework-bundle/zipball/df908e8f9e5f6cc3c9e0d0172e030a5c1c280582
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/http-foundation/zipball/a70c745d4cea48dbd609f4075e5f5cbce453bd52
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/http-kernel/zipball/885211d4bed3f857b8c964011923528a55702aa5
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-php85/zipball/d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/process/zipball/2f8e1a6cdf590ca63715da4d3a7a3327404a523f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/routing/zipball/5d3fd7adf8896c2fdb54e2f0f35b1bcbd9e45090
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/string/zipball/d50e862cb0a0e0886f73ca1f31b865efbb795003
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/var-dumper/zipball/7e99bebcb3f90d8721890f2963463280848cba92
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/var-exporter/zipball/03a60f169c79a28513a78c967316fbc8bf17816f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/thecodingmachine/phpstan-safe-rule/zipball/5c804889253ce9498ef185e108e9f94b6023208e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/thecodingmachine/safe/zipball/2cdd579eeaa2e78e51c7509b50cc9fb89a956236
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/theofidry/cpu-core-counter/zipball/db9508f7b1474469d9d3c53b86f817e344732678
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/webmozarts/assert/zipball/9be6926d8b485f55b9229203f962b51ed377ba68
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/webthinx/codestyle/zipball/61f5b3acfae64db179211625e7d7bf6c2b8ece59
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/duVawZ /usr/bin/composer install --no-interaction (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Problem

The current Twig namespace registration approach using Resources/views/ with Extension/Compiler Pass is not working correctly in Symfony 7.3+/8.0. The error persists:

There are no registered paths for namespace "Graphpinator".

Solution

Refactor to use the modern Symfony 7+ approach with templates/ directory structure, which is automatically recognized by AbstractBundle without requiring manual registration.

Changes Required

1. Move template files

Move templates from old structure to new:

  • src/Resources/views/ui.html.twigtemplates/ui.html.twig
  • src/Resources/views/schema.html.twigtemplates/schema.html.twig

2. Delete unnecessary files

Remove the Extension class that is no longer needed:

  • Delete src/DependencyInjection/GraphpinatorExtension.php

3. Simplify GraphpinatorBundle

Update src/GraphpinatorBundle.php to only include getPath() method:

<?php

declare(strict_types = 1);

namespace Graphpinator\Symfony;

use Symfony\Component\HttpKernel\Bundle\AbstractBundle;

final class GraphpinatorBundle extends AbstractBundle
{
    public function getPath(): string
    {
        return \dirname(__DIR__);
    }
}

Symfony 7+ automatically discovers templates in the templates/ directory at the bundle root when getPath() is defined.

4. Add integration test

Create tests/Integration/TwigNamespaceTest.php to verify Twig namespace registration:

<?php

declare(strict_types = 1);

namespace Graphpinator\Symfony\Tests\Integration;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Kernel;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;

final class TwigNamespaceTest extends TestCase
{
    private Kernel $kernel;

    protected function setUp(): void
    {
        $this->kernel = new class('test', true) extends Kernel {
            public function registerBundles(): array
            {
                return [
                    new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
                    new \Symfony\Bundle\TwigBundle\TwigBundle(),
                    new \Graphpinator\Symfony\GraphpinatorBundle(),
                ];
            }

            public function registerContainerConfiguration(LoaderInterface $loader): void
            {
                $loader->load(function (ContainerBuilder $container): void {
                    $container->loadFromExtension('framework', [
                        'secret' => 'test',
                        'test' => true,
                    ]);
                    
                    $container->loadFromExtension('twig', [
                        'default_path' => '%kernel.project_dir%/templates',
                    ]);
                });
            }
            
            public function getCacheDir(): string
            {
                return sys_get_temp_dir() . '/graphpinator_test_cache';
            }
            
            public function getLogDir(): string
            {
                return sys_get_temp_dir() . '/graphpinator_test_logs';
            }
        };
        
        $this->kernel->boot();
    }

    protected function tearDown(): void
    {
        $cacheDir = $this->kernel->getCacheDir();
        $this->kernel->shutdown();
        
        // Clean up cache
        if (is_dir($cacheDir)) {
            $this->removeDirectory($cacheDir);
        }
    }

    public function testGraphpinatorNamespaceIsRegistered(): void
    {
        $container = $this->kernel->getContainer();
        
        /** @var Environment $twig */
        $twig = $container->get('twig');
        $loader = $twig->getLoader();
        
        self::assertInstanceOf(FilesystemLoader::class, $loader);
        
        // Verify namespace exists
        $namespaces = $loader->getNamespaces();
        self::assertContains('Graphpinator', $namespaces, 'Graphpinator namespace should be registered');
        
        // Verify templates exist and can be loaded
        self::assertTrue(
            $loader->exists('@Graphpinator/ui.html.twig'),
            'Template @Graphpinator/ui.html.twig should exist'
        );
        
        self::assertTrue(
            $loader->exists('@Graphpinator/schema.html.twig'),
            'Template @Graphpinator/schema.html.twig should exist'
        );
    }

    public function testTemplatesCanBeRendered(): void
    {
        $container = $this->kernel->getContainer();
        
        /** @var Environment $twig */
        $twig = $container->get('twig');
        
        // Test ui.html.twig renders without errors
        $uiOutput = $twig->render('@Graphpinator/ui.html.twig', [
            'schemaUrl' => 'http://example.com/graphql',
        ]);
        
        self::assertStringContainsString('GraphiQL', $uiOutput);
        self::assertStri...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/graphpql/graphpinator-symfony/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 13, 2026 12:20
- Move templates from src/Resources/views/ to templates/ directory
- Delete GraphpinatorExtension.php (no longer needed)
- Simplify GraphpinatorBundle to only include getPath() method
- Update tests to reflect new structure
- Add TwigBundle as dev dependency
- Add TwigNamespaceTest integration test

Co-authored-by: peldax <10790033+peldax@users.noreply.github.com>
- Make kernel property nullable for safer tearDown
- Add null check in tearDown before accessing kernel
- Add scandir error handling
- Use @ operator for unlink/rmdir to suppress warnings

Co-authored-by: peldax <10790033+peldax@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor Twig namespace registration for Symfony 7+ Migrate Twig namespace registration to Symfony 7+ auto-discovery Jan 13, 2026
Copilot AI requested a review from peldax January 13, 2026 12:27
@peldax peldax marked this pull request as ready for review January 13, 2026 12:49
@peldax peldax merged commit 9cb6461 into main Jan 13, 2026
5 checks passed
@peldax peldax deleted the copilot/refactor-template-structure branch January 13, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants