SlideShare uma empresa Scribd logo
1 de 84
CakePHP
 新バージョン
   2.0
Graham Weldon

•   PHP developer 11 years

•   CakePHP core
    contributor 4 years

•   Visiting Japan for 3 years
CandyCane
http://my.candycane.jp
•   Recently helping with
    CandyCane

•   Project managed by Ando

•   Lots of good fixes and
    updates made recently

•   Good fun working with
    Japanese developers

• Check it out!
Learning Japanese
•   I am learning Japanese

•   You can speak “very basic”
    Japanese with me

•   But I will have lots of
    problems understanding

•   Please forgive me for any
    mistakes

•   I can write Japanese better
    than I can speak it :-)
CakeFest Conference
•   Manchester, UK

•   4 days!

•   ~100 attendees

•   People from many
    countries

•   Lots of learning

•   Lots of drinking
Overview
Major Points

• No more PHP4
• Refactored throughout
• New Features
• Faster
• New Conventions
PHP5
• 5.2.6+ (Including 5.3)
• Exceptions
• PDO Datasources
• SPL
• Filters
• Support for anonymous functions
Upgrade Console

• Make upgrading simpler
• Do all the tedious work for you
• Automate as much as possible
• Its not perfect
Conventions
File Naming
• MyClass => my_class.php
File Naming
• MyClass => my_class.php
File Naming
• MyClass => my_class.php
• MyClass => MyClass.php
• CamelCased Directories
• “Namespace-ish” separation
• Preparing for PHP 5.3 and PSR-0
File Naming

• Singular directory names
• Model/Behavior/MyBehavior.php
• View/Helper/MyHelper.php
Moved App* Classes


• Model/AppModel.php
• Controller/AppController.php
New Class Loader

• Goodbye to App::import()
• Say Hello to App::uses()

• Similar functionality
• Looks like PHP 5.3 use keyword
App::uses Example
App::uses Example

    App::uses(
       ClassName,
       Package/SubPackage
    );
App::uses Example

    App::uses(
       ClassName,
       Package/SubPackage
    );
App::uses Example

    App::uses(
       ClassName,
       Package/SubPackage
    );
Configuring Packages

• Use App::build() to define where packages
  are located
• Defaults to app/Lib
• Core provides defaults
App::build()

• App::PREPEND
• App::APPEND
• Control your insertion order
• Greater flexibility
Exceptions and
    Errors
cakeError()

• No more cakeError()
• Replaced
 • Exceptions
 • Exception Handlers
• Much better!
Benefits

• Extensible error handling
• Common sense default exceptions
• Configurable handling
• PHP 5.3 awesomeness (if you want)
Custom Rendering
PHP 5.3?
We’re web developers

• HTTP Exceptions
• Named as you would expect
• CakeException for development errors
 • Shows as Error 500 in production
HTTP Exceptions


• All the common HTTP Errors are built in
• Renderer handles display and output
Example
Internationalization
I18n Shortcut

• Simpler
• Returns by default
• Automatic sprintf() functionality
Return by default
• CakePHP 1.x
Return by default
• CakePHP 1.x


• CakePHP 2+
sprintf() built in
• CakePHP 1.x
sprintf() built in
• CakePHP 1.x


• CakePHP 2+
Collections
CakePHP 1.x
• Previously all extensions worked differently
 • Helpers
 • Behaviors
 • Components
 • Tasks
• No common interface / API
CakePHP 2.x

• Collection objects to manage them
• HelperCollection, TaskCollection,
  BehaviorCollection, ComponentCollection
• Similar functionality, same API
• Easy to use and extend
Responsibilities

• Load objects when required
• Unload objects
• Alias objects
• Manage callbacks
Object Loading

• $this->Html now available
• The same API exists for other collections:
 • Behaviors
 • Components
 • Tasks
Aliasing

• Handy for providing custom functionality
• Used to be annoying to “override” defaults
• Possible, but not an elegant solution
CakePHP 1.x
CakePHP 2.x
Global usage

• Once an alias is defined, its used
  everywhere
• Anything else accessing $this->Auth would
  use CustomAuthComponent
More control
     with Collections
• Unload

• Disable

• Enable
Console
Console Changes
• Console now has a home
   • app/Console
• Coloured output
• Better input handling
• Generated help
• Various output formats
Colour
• Simple markup to colourise your output
    • Warning
    • Error
    • Info
    • Question
    • ... and more
Simple markup
Colour
Auto-Generated Help

• Writing documentation sucks
• Using the ConsoleOptionParser gives you
  help for free
• Simple to use
• Two birds with one stone
ConsoleOptionParser
Request
   &
Response
CakeRequest
• All request information in a single place
• Use $this->request everywhere
• Memory use is lower
   • No more copies of copies of copies of
      arrays all over the place
• Backwards compatible interface
CakeResponse

• Again, consolidate logic to a single location
• Use $this->response everywhere
• Backwards compatibility provided
Sessions
Sessions
• Remove duplicated code (DRY)
• Shouldn’t be always included (1.3 fix)
• Modelise data handling
• Access anywhere
• Allow simple customisation
• Separate Caching, Database, etc.
Sessions
           SessionHandler


Database       Cache        PHP
Sessions
           SessionHandler


Database       Cache        PHP
Sessions
           SessionHandler


Database       Cache          PHP


           My Custom Engine
Sessions
           SessionHandler


Database       Cache              PHP
                                Cake
                               Session
           My Custom Engine    Handler
                              Interface
Authentication
Authorization
AuthComponent
       AuthComponent


Authentication   Authorization
AuthComponent

• No more magic logins
• No more magic hashing
• Easier to understand the workflow
• Easier to extend
• Easier to modify
Authentication

• Form
• HTTP Basic
• HTTP Digest
• Custom
Authorization

• Controller
• Action (ACL)
• CRUD (ACL)
• Custom
Example Login
Email
EmailComponent

• No longer a component
• Set of separate classes
• Easily used from Models and Consoles
• Component is deprecated
Email Example
Email Example
 In Models!
Unit Testing
Unit Testing
• PHPUnit is the de-facto standard for PHP
• SimpleTest has less features
• SimpleTest was not PHP5 ready when we
  started
• PHPUnit offers greater features
• More flexibility in testing
Performance
Performance

• All round increases in performance
   • Lazy Loading
   • New Conventions => Less Inflector
   • Simpler dispatch
   • Persistent DBO cache
Benchmark
   “Hello World”




Benchmarks courtesy of Mark Story
Benchmark
     “Basic Blog”




Benchmarks courtesy of Mark Story
Resources
    &
  Links
CakePHP 2
      Documentation
• Book for CakePHP 2
   • http://book.cakephp.org/2.0/ja/
   • We need help for Japanese!
   • Hiromi helping
CakePHP 2
             API
• API is already available
   • http://api20.cakephp.org
• Updated every time a build succeeds
• Automated + up to date
CakePHP 2
Continuous Integration
• We are using Jenkins
• Automated builds and reporting
• Better quality framework
• Consistent testing
• http://ci.cakephp.org
質問はありますか?
ありがとう

Mais conteúdo relacionado

Mais procurados

Coldfusion
ColdfusionColdfusion
Coldfusion
Ram
 
SydPHP May 2012 - Deployment
SydPHP May 2012 - DeploymentSydPHP May 2012 - Deployment
SydPHP May 2012 - Deployment
Graham Weldon
 
Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13
DanWooster1
 

Mais procurados (20)

2021laravelconftwslides6
2021laravelconftwslides62021laravelconftwslides6
2021laravelconftwslides6
 
PHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the Cloud
 
Cfml features modern_coding
Cfml features modern_codingCfml features modern_coding
Cfml features modern_coding
 
Coldfusion
ColdfusionColdfusion
Coldfusion
 
A look at FastCgi & Mod_PHP architecture
A look at FastCgi & Mod_PHP architectureA look at FastCgi & Mod_PHP architecture
A look at FastCgi & Mod_PHP architecture
 
SydPHP May 2012 - Deployment
SydPHP May 2012 - DeploymentSydPHP May 2012 - Deployment
SydPHP May 2012 - Deployment
 
mod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLImod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLI
 
Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13
 
Securing Legacy CFML Code
Securing Legacy CFML CodeSecuring Legacy CFML Code
Securing Legacy CFML Code
 
Scalable PHP
Scalable PHPScalable PHP
Scalable PHP
 
10 Reasons ColdFusion PDFs should rule the world
10 Reasons ColdFusion PDFs should rule the world10 Reasons ColdFusion PDFs should rule the world
10 Reasons ColdFusion PDFs should rule the world
 
Command Box ColdFusion Package Manager, Automation
Command Box ColdFusion Package Manager, AutomationCommand Box ColdFusion Package Manager, Automation
Command Box ColdFusion Package Manager, Automation
 
Performance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPPerformance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHP
 
Hack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security TrainingHack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security Training
 
Getting started with PHP on IBM i
Getting started with PHP on IBM iGetting started with PHP on IBM i
Getting started with PHP on IBM i
 
Can you contain the future - Docker, Container Technologies, The Future, and You
Can you contain the future - Docker, Container Technologies, The Future, and YouCan you contain the future - Docker, Container Technologies, The Future, and You
Can you contain the future - Docker, Container Technologies, The Future, and You
 
CommandBox & ForgeBox Package Management
CommandBox & ForgeBox Package ManagementCommandBox & ForgeBox Package Management
CommandBox & ForgeBox Package Management
 
Locking Down CF Servers
Locking Down CF ServersLocking Down CF Servers
Locking Down CF Servers
 
High Performance Solution for PHP7
High Performance Solution for PHP7High Performance Solution for PHP7
High Performance Solution for PHP7
 
PHP7.1 New Features & Performance
PHP7.1 New Features & PerformancePHP7.1 New Features & Performance
PHP7.1 New Features & Performance
 

Destaque

Optimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x AppsOptimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x Apps
Juan Basso
 

Destaque (7)

Re-imagining CakePHP (OSDC 2010)
Re-imagining CakePHP (OSDC 2010)Re-imagining CakePHP (OSDC 2010)
Re-imagining CakePHP (OSDC 2010)
 
Building 3D apps with Javascript
Building 3D apps with JavascriptBuilding 3D apps with Javascript
Building 3D apps with Javascript
 
CakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle UniversityCakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle University
 
The business behind open source
The business behind open sourceThe business behind open source
The business behind open source
 
SydPHP April 2012
SydPHP April 2012SydPHP April 2012
SydPHP April 2012
 
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014
 
Optimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x AppsOptimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x Apps
 

Semelhante a CakePHP 2.0 - PHP Matsuri 2011

ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
Nexcess.net LLC
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011
Bachkoutou Toutou
 
Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011
Bachkoutou Toutou
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
Howard Greenberg
 
Configuration manager presentation
Configuration manager presentationConfiguration manager presentation
Configuration manager presentation
jeyg
 

Semelhante a CakePHP 2.0 - PHP Matsuri 2011 (20)

Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architecture
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Intro to CakePHP
Intro to CakePHPIntro to CakePHP
Intro to CakePHP
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011
 
Caching strategies with lucee
Caching strategies with luceeCaching strategies with lucee
Caching strategies with lucee
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino API
 
Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
Tuenti Release Workflow
Tuenti Release WorkflowTuenti Release Workflow
Tuenti Release Workflow
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
 
Configuration manager presentation
Configuration manager presentationConfiguration manager presentation
Configuration manager presentation
 
Beyond Domino Designer
Beyond Domino DesignerBeyond Domino Designer
Beyond Domino Designer
 
Php
PhpPhp
Php
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and Symfony
 

Mais de Graham Weldon

20130714 php matsuri - highly available php
20130714   php matsuri - highly available php20130714   php matsuri - highly available php
20130714 php matsuri - highly available php
Graham Weldon
 

Mais de Graham Weldon (9)

HackLang Introduction
HackLang IntroductionHackLang Introduction
HackLang Introduction
 
20130714 php matsuri - highly available php
20130714   php matsuri - highly available php20130714   php matsuri - highly available php
20130714 php matsuri - highly available php
 
SydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overviewSydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overview
 
MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011
 
Nginx in production
Nginx in productionNginx in production
Nginx in production
 
CakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your worldCakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your world
 
CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010
 
Debugging and Profiling PHP
Debugging and Profiling PHPDebugging and Profiling PHP
Debugging and Profiling PHP
 
OSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free ArtOSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free Art
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

CakePHP 2.0 - PHP Matsuri 2011

Notas do Editor

  1. \n
  2. \n
  3. - I have recently been contributing to the CandyCane project\n- Its a great opportunity to work with japanese developers\n
  4. - I am learning japanese\n- People can try and talk to me in Japanese\n- I will probably have too much trouble understanding\n- Best to stick to English\n- I can write Japanese better than I can speak Japanese\n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. - Ask who in the audience has worked on a moderate sized application with translation capabilities\n- Mention how messy code can get when you have lots of shortcut usage in view files\n
  33. - We have made the “double underscore” shortcut function return the result by default\n- Previously it would echo out the result, unless you supplied “true” as the second parameter\n- This makes __() usage shorter\n
  34. \n
  35. - If you wanted to inject values into a tranlated string, you need to use sprintf()\n- This lets you provide a translatable string, without hard coding data that changes\n- We now provide sprintf functionality inside the “double underscore” shortcut function\n- Makes code easier to read and maintain\n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. - If you wanted to provide a custom Authentication component\n- You have to hack in the “Auth” variable on the controller instance\n- Not very flexible\n
  44. - CakePHP 2 allows you to “alias” an object.\n- Here we use the “CustomAuthComponent” with the instance variable name “Auth”\n- Just defined the className for Auth at the Controller level\n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. - Example output\n
  52. - Writing documentation can be a tedious job\n- The option parser can generate console help for users\n
  53. \n
  54. \n
  55. - Copying arrays uses a lot of memory if its done a large number of times\n- We’re referencing an object instead of duplicating arrays\n- Yields memory consumption benefits\n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. - Was very tightly coupled\n- Separate adapters now\n- Easier to modify and extend\n
  66. \n
  67. - Built in Authentication mechanisms\n
  68. \n
  69. - Need to do login checking within the app\n- Its a couple of extra lines\n- Not too bad, given how easy it is to customise now\n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n