The Askeet Tutorial symfony 1.0 This PDF is brought to you by License: Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License Version: askeet-1.0-en-2010-05-24Table of Contents ii Table of Contents Day 1: starting up a project .............................................................................. 9 The challenge............................................................................................................. 9 The project................................................................................................................. 9 What for today ......................................................................................................... 10 Symfony installation ................................................................................................ 10 Project Setup ........................................................................................................... 11 Web service setup.................................................................................................... 11 Web server configuration ................................................................................................... 11 Declare the domain name 12 Test the new configuration................................................................................................. 12 IIS ............................................................................................................................ ...
The Askeet Tutorial
symfony 1.0
This PDF is brought to you by
License: Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License
Version: askeet-1.0-en-2010-05-24Table of Contents ii
Table of Contents
Day 1: starting up a project .............................................................................. 9
The challenge............................................................................................................. 9
The project................................................................................................................. 9
What for today ......................................................................................................... 10
Symfony installation ................................................................................................ 10
Project Setup ........................................................................................................... 11
Web service setup.................................................................................................... 11
Web server configuration ................................................................................................... 11
Declare the domain name 12
Test the new configuration................................................................................................. 12
IIS ............................................................................................................................ 13
Subversion ............................................................................................................... 13
See you Tomorrow 15
Day 2: setting up a data model ....................................................................... 17
Previously on symfony ............................................................................................. 17
The project unveiled ................................................................................................ 17
Where to start? ........................................................................................................ 18
Data Model .............................................................................................................. 18
Relational model................................................................................................................. 18
schema.xml....................................................................................................................... 19
Object model build ............................................................................................................. 22
The database............................................................................................................ 22
Connection.......................................................................................................................... 22
Build ................................................................................................................................... 23
Test data access via a CRUD ................................................................................... 23
See you Tomorrow................................................................................................... 25
Day 3: dive into the MVC architecture ........................................................... 26
Previously on symfony ............................................................................................. 26
The MVC model ....................................................................................................... 26
Change the layout.................................................................................................... 27
A few words about environments ............................................................................ 28
Redefine the default homepage............................................................................... 29
Define test data........................................................................................................ 29
Create a batch to populate the database................................................................. 31
Batch skeleton .................................................................................................................... 31
Data import......................................................................................................................... 32
Launch the batch................................................................................................................ 32
Accessing the data in the model.............................................................................. 33
Modify the question/list template 34
Cleanup 35
----------------- Brought to you byTable of Contents iii
See you Tomorrow................................................................................................... 36
Day 4: refactoring ........................................................................................... 37
Previously on symfony ............................................................................................. 37
Show the answers to a question .............................................................................. 37
A quick look at the action 38
Modify theshowSuccess.php template........................................................................... 38
Add some new test data ..................................................................................................... 39
Modify the model, part I .......................................................................................... 40
Don’t repeat yourself ............................................................................................... 41
Modify the model, part II......................................................................................... 42
Add a field to theUser object model ................................................................................. 42
Modify thesave() method of theInterest object......................................................... 42
Secure the updating request with a transaction ................................................................ 43
Change the template .......................................................................................................... 44
Test the validity of the modification................................................................................... 45
Same for the answers .............................................................................................. 45
Routing .................................................................................................................... 47
Create an alternate version of the title .............................................................................. 47
Custom class....................................................................................................................... 48
Change the links to theshow action .................................................................................. 49
Changing the routing rules ................................................................................................ 49
See you Tomorrow................................................................................................... 50
Day 5: forms and pager................................................................................... 51
Previously on symfony ............................................................................................. 51
Login form ............................................................................................................... 51
Create theuser/login action.......................................................................................... 52
Create theloginSuccess.php template......................................................................... 52
Handle the login form submission...................................................................................... 53
Grant privileges.................................................................................................................. 54
Add theuser/logout action ............................................................................................ 54
Update the layout 55
Question pager ........................................................................................................ 55
Modify thequestion/list action ................................................................................... 55
Use a custom parameter .................................................................................................... 56listSuccess.php template........................................................................... 56
Add page navigation........................................................................................................... 57
Add a routing rule for the subsequent pages ..................................................................... 58
Refactoring .............................................................................................................. 58
Model.................................................................................................................................. 58
Templates ........................................................................................................................... 59
See you Tomorrow................................................................................................... 59
Day 6: security and form validation................................................................ 60
Previously on symfony ............................................................................................. 60
Login form validation............................................................................................... 60
Validation file ................................................