I have a design doubt about Symfony 2. The fact is I want to use a trait into a bundle of mine but I am not sure where to locate the trait. It is not a controller, it is not a model or entity.
I have a solutions on mind but I am not sure if it follows the best practice. The idea is create a new folder called /Trait. It is correct?
<your-bundle>/
├─ AcmeBlogBundle.php
├─ Controller/
├─ Entity/
├─ Trait/ <- My thought
├─ README.md
├─ LICENSE
├─ Resources/
│ ├─ config/
│ ├─ doc/
│ │ └─ index.rst
│ ├─ translations/
│ ├─ views/
│ └─ public/
└─ Tests/
Thank you very much
You can't use Trait
, since it's a php keyword, so you'll have to use Traits
, but apart from that, your suggestion is fine.
Bundle structure is only there for your convenience, it shouldn't be something limiting you, feel free to create any namespaces as you like. In fact you can use Symfony without bundles at all.