wiki:members/GRIP-UQAM/Symfony

Version 25 (modified by https://id.mayfirst.org/gripuqam, 3 years ago) (diff)

--

Symfony Programming

Tutorials

Software using Symfony

EZ Plateform

Symfony Programming Tools

Hacking

autoload.php

MicroKernel

Components

Form

HttpFoundation

PSR-7

Translation

Guard (New in 2.8!)

Use in Symfony framework

Routing

RouteCollection vs RouteCollectionBuilder

RouteCollection

RouteCollectionBuilder

add(string $name, Route $route)

$this addRoute(Route $route, string|null $name = null)

Route add(string $path, string $controller, string|null $name = null

new RouteCollection()->add('root', new Route('/', [
    '_controller' => 'FrameworkBundle:Redirect:redirect',
    'route'       => 'sonata_admin_dashboard',
    'permanent'   => true,
])); // to check
new RouteCollectionBuilder()->addRoute(new Route('/', [
    '_controller' => 'FrameworkBundle:Redirect:redirect',
    'route'       => 'sonata_admin_dashboard',
    'permanent'   => true,
]),
    'root'
); // to check

Does not exist: cf $loader->import(...)

RouteCollectionBuilder import(mixed $resource, string|null $prefix = '/', string $type = null)

Does not exist: cf addCollection

mount($prefix, RouteCollectionBuilder $builder)

$collection = new RouteCollection();
$routing = $loader->import(
    "@SonataAdminBundle/Resources/config/sonata_admin.xml"
);
$routing->setPrefix('/admin');
$collection->addCollection($routing);
$routes->mount('/admin', $routes->import('@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'));

Written for 3.0

Bundles

symfony/framework-standard-edition

Choosing bundles

Bundles not to choose

Admin sonata-project/admin-bundle

Admin without Admin Bundle

Form related

Default value

(Other) Bundles documented by symfony.com

The list is there: http://symfony.com/doc/bundles/

Social Login

OAuth
HybridAuth
OpenID
Feed
Translation sonata-project/translation-bundle
Tree

Tree

Tag and Taxonomy

News, Newsletter

Spatial search

Blog

Payment

Help Desk, Bug Tracking and Ticket

CLI code generation example

$ php bin/console generate:bundle --namespace=AppBundle --bundle-name=AppBundle --format=annotation --dir=../src --no-interaction
$ php bin/console assets:install ../web --symlink --relative
$ php bin/console doctrine:generate:entity --entity="AppBundle:Category" --fields="name:string(255)" --no-interaction
$ php bin/console doctrine:generate:entity --entity="AppBundle:BlogPost" --fields="title:string(255) body:text draft:boolean" --no-interaction
$ php bin/console doctrine:schema:create
$ php bin/console doctrine:schema:update # after modification

See

  • sensio/generator-bundle
  • doctrine/orm

Symfony - Kotti