Skip to content

Symfony flex support #121

Description

@thelem

I have been moving my application from Symfony 3 to Symfony 4 with Flex, but that gives me the error

Template reference "ComurImageBundle:Form:croppable_image_modal.html.twig" not found, did you mean "@ComurImage/Form/croppable_image_modal.html.twig"?

The stack trace shows this coming from my template

{{ form_start(form) }}

Doing some digging, the offending line is actually in comur\image-bundle\DependencyInjection\Compiler\FormPass.php

If, as suggested, I change the line
$template = "ComurImageBundle:Form:croppable_image_modal.html.twig";
to
$template = "@ComurImage/Form/croppable_image_modal.html.twig";

then the problem seems to be solved.

Reviewing the documentation I can see that the first syntax is recommended for 3.1
https://symfony.com/doc/3.1/templating.html#referencing-templates-in-a-bundle

The later syntax is recommended for 3.2 to master (which is 5.1 as I write this)
https://symfony.com/doc/3.2/templating.html#referencing-templates-in-a-bundle
https://symfony.com/doc/master/templates.html#bundle-templates

I'm going to work on a PR to change to the newer syntax. Minimum supported version is already 3.4, so breaking compatibility with 3.1 should not be an issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions