• Save

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

CakePHP Tutorial - OSDC 2010

on

  • 877 views

My slides from the CakePHP tutorial at the OSDC PHP Pre-day in Melbourne, 2010.

My slides from the CakePHP tutorial at the OSDC PHP Pre-day in Melbourne, 2010.

Statistics

Views

Total Views
877
Slideshare-icon Views on SlideShare
871
Embed Views
6

Actions

Likes
1
Downloads
0
Comments
0

1 Embed 6

http://coderwall.com 6

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

CakePHP Tutorial - OSDC 2010 CakePHP Tutorial - OSDC 2010 Presentation Transcript

  • Who is this bloke?• Graham Weldon• PHP: 10 years• CakePHP Core Developer• http://grahamweldon.com• Cake Development Corporation• http://cakedc.com• @predominant
  • • Workshops • Conference• Learn from the core • Presentations from core developers developers• Get one on one support • Community presenters for existing code • Lightning talks• Comfortable, easy to learn environment • Prizes• Cheaper than ever! • Networking
  • Concept• Insurance asset tracking• Photos• Receipts• Documentation• .. anything
  • Concept• Buildings• Rooms• Assets• Attachments• Comments
  • Defining Standards• Models• Views• Controllers• Libraries• Database
  • Standards: Models• Class name: Singular • Project • SoftwareProject• Filename: Singular (lowercase, underscored) • project.php • software_project.php• Path: /app/models/
  • Standards: Views• File name: Match Controller action name• Path: /app/views/<controller>/<action>.ctp
  • Standards: Controllers• Class Name: Plural • ProjectsController• File Name: Plural (lowercase, underscored) • projects_controller.php• Path: /app/controllers/
  • Standards: Database• Tables: Plural (lowercase, underscored) • projects • software_projects• Foreign Keys: Singlular (lowercase, id suffix) • project_id • software_project_id
  • Designing the Database
  • User
  • User Building
  • User Building Building
  • User Building Building Room Room
  • User Building Building Room Room Room Room Room Room
  • User Building Building Room Room Room Room Room Room A
  • User Building Building Room Room Room Room Room Room A A A
  • User Building Building Room Room Room Room Room Room A A A A A
  • Scaffolding
  • Scaffolding ?? Quick Proof of concept NOT FOR PRODUCTION
  • Scaffolding
  • Baking
  • ModelsControllersViews
  • ModelsRepresentation of data, andprovision of operations to beperformed on dataControllersViews
  • ModelsRepresentation of data, andprovision of operations to beperformed on dataControllersApplication flow control. Pass modeldata to views, prevent unauthorisedaccess.Views
  • ModelsRepresentation of data, andprovision of operations to beperformed on dataControllersApplication flow control. Pass modeldata to views, prevent unauthorisedaccess.ViewsOutput from application. XHTML,JSON, XML, etc.
  • ModelsControllersViews
  • Models$ cake bake model user$ cake bake model building$ cake bake model room$ cake bake model assetControllersViews
  • Models$ cake bake model user$ cake bake model building$ cake bake model room$ cake bake model assetControllers$ cake bake controller users$ cake bake controller buildings$ cake bake controller rooms$ cake bake controller assetsViews
  • Models$ cake bake model user$ cake bake model building$ cake bake model room$ cake bake model assetControllers$ cake bake controller users$ cake bake controller buildings$ cake bake controller rooms$ cake bake controller assetsViews$ cake bake view all
  • Models$ cake bake model user$ cake bake model project$ cake bake model section$ cake bake model requirementControllers$ cake bake controller users$ cake bake controller projects$ cake bake controller sections$ cake bake controller requirementsViews$ cake bake view all There are shortcuts for most things
  • Models$ cake bake model user$ cake bake model project$ cake bake model section$ cake bake model requirementControllers$ cake bake controller users$ cake bake controller projects$ cake bake controller sections$ cake bake controller requirementsViews$ cake bake view all There are shortcuts for Console help: most things $ cake bake help
  • Models$ cake bake model user$ cake bake model building$ cake bake model room$ cake bake model assetControllers$ cake bake controller users$ cake bake controller buildings$ cake bake controller rooms$ cake bake controller assetsViews$ cake bake view all There are shortcuts for Console help: most things $ cake bake help
  • What was generated?
  • Associations
  • Has One 1 .. 1
  • Has Many
  • Has Many 1 .. n
  • Belongs To 1 .. n
  • Has And Belongs To Many
  • Has And Belongs To Many n .. n
  • Has And Belongs To Many n .. n HABTM
  • Authentication
  • Add the AuthComponent
  • Deployment
  • DeploymentConfigure::write(‘debug’, 2);// Great for development
  • DeploymentConfigure::write(‘debug’, 2);// Great for developmentConfigure::write(‘debug’, 1);// Great for showing the boss
  • Disable DebuggingConfigure::write(‘debug’, 2);// Great for developmentConfigure::write(‘debug’, 1);// Great for showing the bossConfigure::write(‘debug’, 0);// Production ready
  • What is debug doing?• Caching Model structure• Caching File locations • Initial hit is slow, as it discovers file locations through recursive searches • Leaving debug enabled makes this happen on every request after 10 seconds cache time
  • Cache Queries• (Where it makes sense...) enable Model::cacheQueries• Any duplicate queries in a request will cache the results• Read -> Write -> Read • Be careful!
  • Rewrite Rules• Disable: AllowOverride all• Move rewrite rules from .htaccess• Place into vhost definition in apache• Apache reads these once, not on every request
  • View Caching• Configurable in the core• Cache elements based on their content• Don’t overestimate the importance of up to date data• Book http://book.cakephp.org has the best descriptions for this
  • Persist Models• AppController::persistModel = true• ClassRegistry caching• Model Caching• Move this cache to APC if available
  • Setup / Configure APC• Examples in core.php
  • Alternate Content RSS, JSON, XML
  • Training
  • Training• Beginners • Cake Development Corporation• Experienced users • Employs most of the• Code Review CakePHP Core dev’s• Project Management • Largest supporter of the CakePHP Framework
  • Thanks!