Wednesday, May 28, 2014

Build your first Symfony2 application - Notes

My Notes From: Build your first Symfony2 application
https://joind.in/10662
** Framework Overview

** History
Mohave
Standard Distribution

** Use Composer
"Doc-Treen"
composer create-project symfony/framework-standard-edition myProject/ 2.4.4

777 app/cache
777 app/logs

app directory is where all the app stuff lives.
bin directory containst a couple binaries
src where all custom code
vendor third party librarires
web is document root

assetic is a thing

use composer again!

config/config.yml
config/routing.yml
config/security.yml

Resources

** Web Directiory
app.php
app_dev.php
bundles

** Bundles
controllers, entities, views, configs, forms, etc.

** Libraries
Composer install should update all the things.

app console generate:bundle
namespace - then Bundle becuse you need to name bundles "Bundle"

He prefers annotation configuration
app/AppKernel.php

routing.yml??

app/console cache:clear
sudo app/console cache:clear

** Doctrine Databases
He's having problems... Ooops.

app/console doctrine:generate:create
app/console doctrine:generate:entity

app/console doctrine:schema:update --dump-sql
app/console doctrine:schema:update --force

Doctrine Migrations??
Not going to show you those right now.

app/console doctrine:generate:crud

Doctrine has a soft delete extension.
Remove removes it from the database hard.

Make sure you have a service layer between your controller and doctrine.
It's the best practice.

** Twig!
Define Blocks

** Forms!
Forms! Objects! Validation!
PostType extends AbstractType

Just reviewing the automatically generated code for form.

Group Validators ??

Propel (http://propelorm.org/) is an alternative to Doctrine.

** Services

Creating a PDO service from scratch.
When creating a PDO service don't register a service for "/PDO" but use "PDO" instead

Never inject the container because it's untestable.

No comments:

Post a Comment