I
I
Ivan2014-09-05 13:18:35
symfony
Ivan, 2014-09-05 13:18:35

How to completely get rid of bundles in symfony templates and translations?

At the suggestion of the esteemed Sergey Protko , he decided to use this approach in the application: elnur.pro/symfony-without-bundles
This is especially convenient after the number of bundles exceeded 10.
Everything is fine, but I can't figure out the templates and translations.
Now this is the structure:

spoiler
acme.com
  app
    config
    Resources
      translations
        Backend
          ru
            ...
          en
            ...
        Dashboard
          ru
          en
        Frontend
          ru
          en
        Shop
          ru
          en
        ...
      views
        App
          Exception
        Backend
          ...
        Dashboard
          ...
        Frontend
          ...
        Shop
          Product
            list.html.twig
            _list.html.twig
            _list-item.html.twig
          ProductBrand
          ProductCategory
          ...
  src
    Dodo
      AppBundle
        Controller
          Backend
            UsersController.php
            SecurityController.php
          Dashboard
            ...
            SecurityController.php
          Frontend
            PageController.php
          Shop
            ProductController.php
            ProductBrandController.php
            ProductCategoryController.php
        DependencyInjection
        Resources
          config
            doctrine
              backend
                admin.orm.yml
              dashboard
                client.yml
              shop
                Product.yml
                ProductBrand.yml
                ProductCategory.yml
            routing
              backend
                user.orm.yml
                security.orm.yml
                routing.yml
              dashboard
                security.yml
                routing.yml
              frontend
                page.yml
                routing.yml
              shop
                product.yml
                product.brand.yml
                product.category.yml
                routing.yml
            services
              dashboard.yml
              backend.yml
              twig.yml
              ...
            validation
              ...
        Security
          Backend
          Dashboard
      Entity
        Backend
          ...
        Dashboard
          ...
        Shop
          Product.php
          ProductBrand.php
          ProductCategory.php
      Model
        Backend
          ...
        Dashboard
          ...
        Shop
          Product.php
          ProductBrand.php
          ProductCategory.php
      ...

The question is this.
How to completely get rid of bundles in templates and translations?
For example, now in the controller you have to write crutches like :Dashboard/Security:login.html.twig I would
like to rewrite this case so that all templates are loaded like this: Dashboard:Security:login.html.twig
so that in the Backend:User:list.html.twig template you can write {% include '_list-item.html.twig' %} instead of {% include 'Backend:User:_list-item.html.twig' %} (in short , as in Yii).
With translations, I’m still worse: I still haven’t figured out how to make such a structure work (as in the spoiler above).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Solovyov, 2014-09-05
@0neS

For example, now in the controller you have to write crutches like :Dashboard/Security:login.html.twig - why do you think this is a crutch? And if you need to load a template from somewhere else, how do you do it with your structure?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question