Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Symfony] Create a Flex Recipe #316

Closed
alexander-schranz opened this issue Dec 13, 2023 · 7 comments
Closed

[Symfony] Create a Flex Recipe #316

alexander-schranz opened this issue Dec 13, 2023 · 7 comments
Labels
features New feature or request Integration: Symfony Symfony related issue

Comments

@alexander-schranz
Copy link
Member

A flex recipe is considered to automatically registering the bundle and provide a test configuration for Symfony.

What should a flex recipe to https://github.com/symfony/recipes-contrib

config/packages/schranz_search.yaml

schranz_search:
    schemas:
        default:
            dir: '%kernel.project_dir%/config/schemas'
    engines:
        default:
            adapter: '%env(SEAL_DSN)%'

config/schemas/.gitignore

Create a empty schemas directory where the user can then create it schema files

SEAL_DSN for .env

SEAL_DSN=loupe://var/indexes

SEAL_DSN for .env.test

SEAL_DSN=memory://

Recipe manifest.json

{
    "bundles": {
        "Schranz\\Search\\Integration\\Symfony\\SearchBundle": ["all"]
    },
    "copy-from-recipe": {
        "config/": "%CONFIG_DIR%/"
    }
}
@alexander-schranz alexander-schranz added features New feature or request Integration: Symfony Symfony related issue labels Dec 13, 2023
@ToshY
Copy link
Contributor

ToshY commented Dec 13, 2023

Hey @alexander-schranz 👋

If you'd like, I can try to create a PR for this in the recipes-contrib repo, as it doesn't seem to difficult to do with the info you've already provided.

Only thing I'm not sure if it is possible is the .env.test. I do not see other bundles having this configured, maybe I'm missing something (?). Instead maybe add it as a comment is an alternative.

manifest.json

{
    "bundles": {
        "Schranz\\Search\\Integration\\Symfony\\SearchBundle": ["all"]
    },
    "copy-from-recipe": {
        "config/": "%CONFIG_DIR%/"
    },
   "env": {
        "#1": "SEAL_DSN=\"memory://\"",
        "SEAL_DSN": "loupe://var/indexes"
    },
}

@alexander-schranz
Copy link
Member Author

@ToshY we could use add-lines configuration for the .env.test see https://github.com/symfony/recipes/pull/1239/files as example.

@ToshY
Copy link
Contributor

ToshY commented Dec 14, 2023

I've created a PR: symfony/recipes-contrib#1575. If there's anything that needs to be changed, let me know.

@dhirtzbruch
Copy link
Contributor

Only thing I'm not sure if it is possible is the .env.test. I do not see other bundles having this configured, maybe I'm missing something (?). Instead maybe add it as a comment is an alternative.

From other bundles, I think the standard way would be more like changing the parameters.yaml configuration to include a config specific for the test environment. E.g. JMS serializer uses that for providing different config between prod / dev environment.

config/packages/schranz_search.yaml

schranz_search:
    schemas:
        default:
            dir: '%kernel.project_dir%/config/schemas'
    engines:
        default:
            adapter: '%env(SEAL_DSN)%'

when@test:
    schranz_search:
        engines:
            default:
                adapter: 'memory://'

@alexander-schranz
Copy link
Member Author

I'm also fine with that for the test env we should also set the index_prefix_name: test_ in the recipe.

@ToshY
Copy link
Contributor

ToshY commented Dec 18, 2023

Hey @alexander-schranz 👋

I see the recipe has been merged, so I guess this can be closed 🙂

@alexander-schranz
Copy link
Member Author

@ToshY thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features New feature or request Integration: Symfony Symfony related issue
Projects
None yet
Development

No branches or pull requests

3 participants