Creare bundle - Tutorial Symfony

Postat la Tue 26 May 2015 in tutoriale, symfony 2

In Symfony se foloseste notiunea de bundle ce poate fi asemanat unui modul/plugin si care poate apoi fi utilizat in diverse proiecte.

Aceste bundle-uri se gasesc in folderul /src si cel mai des se regasesc sub structura de Producator/NumeBundle. Din fericire Symfony include un utilitar ce genereaza aceasta structura si adauga intrari in fisierele de configurare:

php app/console generate:bundle
.....
Bundle namespace: Tutorial/TestBundle
.....
Target directory [/var/www/home/www/symfo_home/src]:
.....
Configuration format (yml, xml, php, or annotation): yml
You are going to generate a "Tutorial\TestBundle\TutorialTestBundle" bundle
in "/var/www/home/www/symfo_home/src/" using the "yml" format.

Do you confirm generation [yes]?

Generating the bundle code: OK
Checking that the bundle is autoloaded: OK
Confirm automatic update of your Kernel [yes]?
Enabling the bundle inside the Kernel: OK
Confirm automatic update of the Routing [yes]?
Importing the bundle routing resource: OK

Vom gasi noul bundle creat in folderul src/Tutorial/TestBundle si sunt incluse intrari in urmatoarele fisiere de configurare:

  • app/AppKernel.php
  • app/Resource/routing.yml

Recomandari privind modul de numire a acestor bundle gasiti aici.

Anterior - Creare virtualhost in apache Urmator - Conectare la baza de date