en implementar la aplicación • Evita problemas comunes • Consigue un código reutilizable • Se beneficia del conocomiento de otros desarolladores • Desarrollo Rápido (RAD)
• Fácil de usar, rápido de aprender • RAD prototyping (scaffolding) • Generdor de código (bake) • unit test (phpunit) • Gran cantidad de plugins publicados • Gran comunidad • versión 1.3, php 4.3.2+ • versión 2.0, php 5.2.9+ (y pdo)
Interactive Bake Shell --------------------------------------------------------------- [D]atabase Configuration [M]odel [V]iew [C]ontroller [P]roject [F]ixture [T]est case [Q]uit What would you like to Bake? (D/M/V/C/P/F/T/Q) >
TABLE posts ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, title VARCHAR(50), body TEXT, created DATETIME DEFAULT NULL, modified DATETIME DEFAULT NULL ); /* Then insert some posts for testing: */ INSERT INTO posts (title,body,created) VALUES ('The title', 'This is the post body.', NOW()); INSERT INTO posts (title,body,created) VALUES ('A title once again', 'And the post body follows.', NOW()); INSERT INTO posts (title,body,created) VALUES ('Title strikes back', 'This is really exciting! Not.', NOW());
CakePHP v2.0.4 Console --------------------------------------------------------------- App : cakephp Path: /home/andy/www/apps/cakephp/ --------------------------------------------------------------- Baking controller class for Posts... Creating file /home/andy/www/apps/cakephp/Controller/PostsController.php Wrote `/home/andy/www/apps/cakephp/Controller/PostsController.php` Bake is detecting possible fixtures... Baking test case for Posts Controller ... Creating file /home/andy/www/apps/cakephp/Test/Case/Controller/PostsControllerTest.php Wrote `/home/andy/www/apps/cakephp/Test/Case/Controller/PostsControllerTest.php`
Si no existe un modelo - Cake usará un modelo genérico • Es todo dinámico - no hay código para modificar • Útil mientras el diseño de la BBDD no esté definido
model class for Post... Baking controller class for Posts... Baking test case for Posts Controller ... Baking `index` view file... Baking `view` view file... Baking `add` view file... Baking `edit` view file... Bake All complete
sobrescribe ficheros sin confirmar • Scaffolding y el código de bake son visualmente iguales • Usa Scaffolding si es útil para ti - o salta directamente a código que puedas tocar. • Pero usa bake - ahorra mucho tiempo
automáticamente las reglas de validación • Hay muchas reglas de validación en el core • Es fácil escribir tus proprias reglas de validación • Las reglas se puede desactivar o modificar
o todo a la vez • Interactivo o no • Dinámico (Scaffolding) o no • Las plantillas de cada clase se puede modificar • Detecta relaciones en la BBDD • El código se adapta a las relaciones • No es obligotario usarlo
Debug Kit - un gran ayuda • Otras comandos de la consola • Projectos utiles/ejemplos • Para leer: CakePHP 1.3 Application Cookbook - Mariano Iglesias 2011