• ZendFrame 2 Manual en Español

    ZendFrame 2 Manual en Español

    .......................................................................................................... 23
    Introducción ............................................................................................................................. 23
    Inicio rápido con Zend_Application ............................................................................................. 23
    Usando Zend_Tool ............................................................................................................ 23
    Añadir Zend_Application a su aplicación .............................................................................. 25
    Agregando y Creando Recursos ........................................................................................... 27
    Próximos pasos con Zend_Application ................................................................................. 28
    Teoría de Operación .................................................................................................................. 28
    Bootstrapping ................................................................................................................... 29
    Plugins de Recursos .......................................................................................................... 34
    Ejemplos ................................................................................................................................. 36
    Funcionalidad Básica ................................................................................................................. 39
    Zend_Application .............................................................................................................. 39
    Zend_Application_Bootstrap_Bootstrapper ............................................................................ 42
    Zend_Application_Bootstrap_ResourceBootstrapper ................................................................ 43
    Zend_Application_Bootstrap_BootstrapAbstract ..................................................................... 44
    Zend_Application_Bootstrap_Bootstrap ................................................................................ 47
    Zend_Application_Resource_Resource .................................................................................. 47
    Zend_Application_Resource_ResourceAbstract ...................................................................... 47
    Plugins de Recursos Disponibles ................................................................................................. 49
    Zend_Application_Resource_Db .......................................................................................... 49
    Zend_Application_Resource_Frontcontroller .......................................................................... 50
    Zend_Application_Resource_Layout ..................................................................................... 51
    Zend_Application_Resource_Modules .................................................................................. 52

    iii

    Guía de Referencia del Programador

    Zend_Application_Resource_Navigation ............................................................................... 53
    Zend_Application_Resource_Router ..................................................................................... 54
    Zend_Application_Resource_Session .................................................................................... 54
    Zend_Application_Resource_View ....................................................................................... 55
    5. Zend_Auth ................................................................................................................................... 57
    Introducción ............................................................................................................................. 57
    Adaptadores ..................................................................................................................... 57
    Resultados ....................................................................................................................... 58
    Persistencia de Identidad .................................................................................................... 59
    Uso ................................................................................................................................ 61
    Tabla de base de datos de autenticación ........................................................................................ 63
    Introducción ..................................................................................................................... 63
    Advanced Usage: Manteniendo el resultado del Objeto DbTable ................................................ 65
    Ejemplo de Uso Avanzado ................................................................................................. 66
    Autenticación "Digest" ............................................................................................................... 67
    Introducción ..................................................................................................................... 67
    Detalles Específicos .......................................................................................................... 68
    Identidad ......................................................................................................................... 68
    Adaptador de Autenticación HTTP .............................................................................................. 68
    Introducción ..................................................................................................................... 68
    Descripción del diseño ....................................................................................................... 69
    Opciones de Configuración ................................................................................................. 69
    Resolvers ......................................................................................................................... 70
    Uso Básico ...................................................................................................................... 70
    LDAP Authentication ................................................................................................................ 71
    Introduction ..................................................................................................................... 71
    Usage ............................................................................................................................. 72
    The API .......................................................................................................................... 73
    Server Options ................................................................................................................. 75
    Collecting Debugging Messages .........................................................................

  • Zend Framework 2 Documentation

    Zend Framework 2 Documentation

    Database . . . . . . . . . . . . . .
    15.2 Quick Facts Zend\Db\Sql . . . . . . . . . . . .
    15.3 Writing the mapper implementation . . . . . . .
    15.4 Refactoring hidden dependencies . . . . . . . .
    15.5 Finishing the mapper . . . . . . . . . . . . . . .
    15.6 Conclusion . . . . . . . . . . . . . . . . . . . .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

    71
    71
    71
    73
    79
    81
    83

    16 Understanding the Router
    16.1 Different route types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    16.2 Different routing concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    16.3 A practical example for our Blog Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    85
    85
    87
    90

    .
    .
    .
    .
    .

    .
    .
    .
    .
    .

    17 Making use of Forms and Fieldsets
    17.1 Core components . . . . . . . . . . . . . . . . . . . . .
    17.2 Creating your first Fieldset . . . . . . . . . . . . . . . .
    17.3 Creating the PostForm . . . . . . . . . . . . . . . . . .
    17.4 Adding a new Post . . . . . . . . . . . . . . . . . . . .
    17.5 Displaying the form . . . . . . . . . . . . . . . . . . .
    17.6 Controller Logic for basically all Forms . . . . . . . . .
    17.7 Zend\Form and Zend\Stdlib\Hydrator working together .
    17.8 Conclusion . . . . . . . . . . . . . . . . . . . . . . . .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .

    95
    95
    95
    96
    97
    101
    103
    109
    112

    18 Editing and Deleting Data
    18.1 Binding Objects to Forms . . . . . .
    18.2 Adding the edit-route . . . . . . . . .
    18.3 Creating the edit-template . . . . . .
    18.4 Implementing the delete functionality

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    113
    113
    115
    116
    116

    ii

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    18.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
    19 Reviewing the Blog-application
    19.1 Do we always need all the layers and interfaces? . . . . . . .
    19.2 Having many objects, won’t there be much code-duplication?
    19.3 Why are there so many controllers? . . . . . . . . . . . . . .
    19.4 Do you have more questions? PR them! . . . . . . . . . . . .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    125
    125
    125
    126
    126

    20 Getting Started with Zend Framework 2
    127
    20.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
    20.2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
    21 A quick tour of the skeleton application
    133
    21.1 The dispatch cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
    22 The MyTaskList application
    137
    22.1 The Checklist module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
    22.2 The Module class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
    23 The application’s pages
    23.1 Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    23.2 The TaskController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    23.3 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    23.4 Using Service Manager to configure the database credentials and inject into the controller

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    141
    141
    142
    143
    146

    24 Listing tasks
    149
    24.1 Redirect the home page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
    25 Styling

    153

    26 Adding new tasks

    155

    27 Editing a task

    161

    28 Deleting a task

    165

    29 Application Diagnostics

    167

    30 Step-by-step debugging

    169

    31 Conclusion

    171

    32 Zend Framework Tool (ZFTool)
    32.1 Installation using Composer . . . . . . .
    32.2 Manual installation . . . . . . . . . . . .
    32.3 Without installation, using the PHAR file
    32.4 Usage . . . . . . . . . . . . . . . . . . .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    173
    173
    173
    173
    174

    33 Learning Dependency Injection
    33.1 Very brief introduction to Di. . . . . . . . . . . . . . .
    33.2 Simplest usage case (2 classes, one consumes the other)
    33.3 Simplest Usage Case Without Type-hints . . . . . . . .
    33.4 Simplest usage case with Compiled Definition . . . . .
    33.5 Creating a precompiled definition for others to use . . .
    33.6 Using Multiple Definitions From Multiple Sources . . .
    33.7 Generating Service Locators . . . . . . . . . . . . . . .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .

    177
    177
    177
    179
    180
    182
    182
    183

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    .
    .
    .
    .

    iii

    34 Unit Testing a Zend Framework 2 application
    34.1 Setting up phpunit to use composer’s autoload.php
    34.2 Setting up the tests directory . . . . . . . . . . . .
    34.3 Bootstrapping your tests . . . . . . . . . . . . . .
    34.4 Your first controller test . . . . . . . . . . . . . .
    34.5 A failing test case . . . . . . . . . . . . . . . . .
    34.6 Configuring the service manager for the tests . . .
    34.7 Testing actions with POST . . . . . . . . . . . . .
    34.8 Testing model entities . . . . . . . . . . . . . . .
    34.9 Testing model tables . . . . . . . . . . . . . . . .
    34.10 Conclusion . . . . . . . . . . . . . . . . . . . . .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    .
    .
    .
    .
    .
    .

Record with your Camera and Share it

Media/Report