Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
CakePHP 3
➔ Ambiente de
desenvolvimento
Vagrant
➔ Composer
● Download
curl -sS https://getcomposer.org/installer | php
● composer.json
○ require vendor/name: version
○ ph...
➔ Criando um novo projeto
php composer.phar create-project cakephp/app
lovejobs
➔ Estrutura de arquivos
Config
Console
Controller
Component
index.php
Lib
Locale
Model
Behavior
Datasource
Plugin
Test
tmp...
➔ Configuração
● bootstrap.php
● paths.php
● autoload.php
● bootstrap_cli.php
● routes.php
● app.php
○ Debug (true / false...
➔ Aplicação
Companies and Users
Users create Reviews (Public / Private)
Reviews belongsTo Company
https://www.dropbox.com/...
➔ Migrations
● Phinx
http://phinx.org
● Criando
○
○ bake migration CreateCompanies
○ bake migration create_companies
○ bak...
➔ Bake
/bin/cake bake all <model>
➔ Request
➔ Models
Tables
● Criar consultas
● Fornecedor finds
● Validar e salvar entidades
● Deletar entidades
● Definir associaçõe...
➔ Models
Recursive
Containable
afterFind callback
Virtual fields
➔ Controllers
AppController
initialize()
$uses -> loadModel()
Views
set(‘name’, $value)
render(‘template’)
Controll flow
r...
➔ Controllers
Request
$this->request->params
$this->request->param($key)
$this->request->query($key)
$this->request->data(...
➔ Componentes
Session, Flash
Cookie
Auth
Security, Csrf
RequestHandler
Paginator
Acl -> https://www.github.com/cakephp/acl
➔ Views
Views, Elements, Layouts, Helpers
➔ Helpers
Flash, Form, Html, Number, Paginator, Time, Url
➔ Authentication
➔ ACL
CakePHP 3
Upcoming SlideShare
Loading in …5
×

CakePHP 3

689 views

Published on

Workshop in Recife, 01/28/16

Published in: Internet
  • Be the first to comment

  • Be the first to like this

CakePHP 3

  1. 1. CakePHP 3
  2. 2. ➔ Ambiente de desenvolvimento Vagrant
  3. 3. ➔ Composer ● Download curl -sS https://getcomposer.org/installer | php ● composer.json ○ require vendor/name: version ○ php composer.phar install ○ composer.lock ○ php composer.phar update dependencies & lock file ○ https://packagist.org/
  4. 4. ➔ Criando um novo projeto php composer.phar create-project cakephp/app lovejobs
  5. 5. ➔ Estrutura de arquivos Config Console Controller Component index.php Lib Locale Model Behavior Datasource Plugin Test tmp Vendor View Elements Emails Layouts Helper webroot composer.json composer.lock config index.php plugins src Console Controller Component Model Behavior Entity Table Template Element Email Layout View Helper tests tmp vendor logs webroot
  6. 6. ➔ Configuração ● bootstrap.php ● paths.php ● autoload.php ● bootstrap_cli.php ● routes.php ● app.php ○ Debug (true / false) ○ App path configurations ○ Security.salt ○ Asset.timestamp ○ Cache configuration ○ Email transports & configuration ○ Datasource configuration ○ Log configuration ○ Session handler configuration
  7. 7. ➔ Aplicação Companies and Users Users create Reviews (Public / Private) Reviews belongsTo Company https://www.dropbox.com/s/dz1qaezf43jve3y/schema.sql?dl=0
  8. 8. ➔ Migrations ● Phinx http://phinx.org ● Criando ○ ○ bake migration CreateCompanies ○ bake migration create_companies ○ bake migration addRatingToCompany ○ bake migration removeRatingToCompany ○ migrations create MyCustomMigration ○ bake migration_snapshot initial ● Aplicando ○ migrations migrate ○ migrations migrate -t <version> ● Revertendo ○ migrations rollback ○ migrations rollback -t <version> ● migrations status ● migrations mark_migrated
  9. 9. ➔ Bake /bin/cake bake all <model>
  10. 10. ➔ Request
  11. 11. ➔ Models Tables ● Criar consultas ● Fornecedor finds ● Validar e salvar entidades ● Deletar entidades ● Definir associações ● Callbacks ● Behaviors Queries Entidades CakePHPDatabaseConnection CakePHPDatabaseDialect CakePHPDatabaseType CakePHPDatabaseTable CakePHPDatabaseBehavior CakePHPDatabaseQuery CakePHPDatabaseResultSet CakePHPDatabaseEntity
  12. 12. ➔ Models Recursive Containable afterFind callback Virtual fields
  13. 13. ➔ Controllers AppController initialize() $uses -> loadModel() Views set(‘name’, $value) render(‘template’) Controll flow redirect($url, $code) Callbacks beforeFilter($event) beforeRender($event) afterFilter($event) Components Helpers
  14. 14. ➔ Controllers Request $this->request->params $this->request->param($key) $this->request->query($key) $this->request->data($key) $this->request->is(‘detector’) post / get / ajax / mobile / ssl $this->request->session() need screenshot for cakephp request debug
  15. 15. ➔ Componentes Session, Flash Cookie Auth Security, Csrf RequestHandler Paginator Acl -> https://www.github.com/cakephp/acl
  16. 16. ➔ Views Views, Elements, Layouts, Helpers
  17. 17. ➔ Helpers Flash, Form, Html, Number, Paginator, Time, Url
  18. 18. ➔ Authentication
  19. 19. ➔ ACL

×