Top Banner
Copyright © 2007, Zend Technologies Inc. ZEND_TOOL IN ZF 1.8 By Ralph Schindler
56

Zend_Tool In ZF 1.8 Webinar

Nov 01, 2014

Download

Technology

Ralph Schindler

These slides were presented on 6/30/06 in a webinar for zend.com. The recorded webinar can be seen from the zend.com site.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Zend_Tool In ZF 1.8 Webinar

Copyright © 2007, Zend Technologies Inc.

ZEND_TOOL IN ZF 1.8 By Ralph Schindler

Page 2: Zend_Tool In ZF 1.8 Webinar

Overview

•  Overview   The Problem   The Solution   Obtaining Zend_Tool

•  Basic Usage   Zend_Tool usage OTB (out the box)   Zend_CodeGenerator & Zend_Reflection

•  Advanced Usage   Extending Zend_Tool

| Jul-1-09 Overview | 2

Page 3: Zend_Tool In ZF 1.8 Webinar

“ OVERVIEW

What’s this thing all about?

| Jul-1-09 Overview | 3

Page 4: Zend_Tool In ZF 1.8 Webinar

Overview

•  The Problem – all the buzzwords   RAD – Rapid Application Development   Code Generation

•  The generation of code during “development time” that will run during “production time”

•  Development time code generation is ALWAYS better than runtime introspection

  Scaffolding •  Templates •  Meta programming •  CRUD

| Jul-1-09 Overview | 4

Page 5: Zend_Tool In ZF 1.8 Webinar

Overview

•  In a nutshell:   “Zend_Tool is both RAD tools as well as a framework for

exposing your own set of tooling needs to the Zend_Tool user interface.”

•  Main Classes & APIs:   Zend_Tool_Framework   Zend_Tool_Project

•  Supporting Classes & APIs:   Zend_CodeGenerator   Zend_Reflection

| Jul-1-09 Overview | 5

Page 6: Zend_Tool In ZF 1.8 Webinar

Overview

•  Download and go •  SVN

  Create a link to the proper runner (zf.sh/zf.bat) •  Preferably in the system path

  Add Zend Framework library to global include_path

•  Zend Server •  Pear Channel (http://pear.zfcampus.org/)

| Jul-1-09 Overview | 6

Page 7: Zend_Tool In ZF 1.8 Webinar

Overview

•  How it works   Zend_Tool_Framework looks for providers, by default, on the

include_path   Zend_Tool_Project is consumed by Zend_Tool_Framework

•  This allows Zend_Tool_Project to be only concerned with “project” problems

•  This also allows Zend_Tool_Framework to focus on the problem of knowing which requests are good, and knowing how to dispatch said request

  Zend_Tool_Framework provides a client to the user   That client in 1.8 is the command line client

| Jul-1-09 Overview | 7

Page 8: Zend_Tool In ZF 1.8 Webinar

“ BASIC USAGE

So, how do I use this thing?

| Jul-1-09 Basic Usage | 8

Page 9: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 9

Page 10: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 10

Page 11: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 11

Page 12: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 12

Page 13: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 13

Page 14: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 14

Page 15: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 15

Page 16: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 16

Page 17: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 17

Page 18: Zend_Tool In ZF 1.8 Webinar

Basic Usage

| Jul-1-09 Basic Usage | 18

Page 19: Zend_Tool In ZF 1.8 Webinar

“ ADVANCED USAGE

So, how do I extend this thing?

| Jul-1-09 Advanced Usage | 19

Page 20: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Zend_Tool_Framework Architecture   Registry

•  A container for all of the Zend_Tool_Framework sub componets   Providers

•  The built in providers   Loaders

•  The component responsible for finding providers & manifests   Manifest

•  A dictionary of metadata to be used by clients and providers   Client

•  The subcomponent responsible for presenting the toolchain to the user as well as building and dispatching requests

| Jul-1-09 Advanced Usage | 20

Page 21: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Zend_Tool_Project Architecture   Project Profile

•  The description of the project in terms as a tree structure of resources

  Resource •  A resources is a node in the “project profile tree” •  Can be a single node, or a parent of a collection of nodes •  Is further described by the “context” associated with it.

  Providers •  Set of providers responsible for project based capabilities

  Context •  An object that describes the role of any given resources.

| Jul-1-09 Advanced Usage | 21

Page 22: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Zend_Reflection   Extends the API of PHP’s Reflection class to handle some

missing functionality •  Docblock introspection (ability to get tags and descriptions) •  File introspection

| Jul-1-09 Advanced Usage | 22

Page 23: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Zend_CodeGenerator   Purpose is to generate OO code with an OO interface   API very similar to Reflection API, but the purpose is exactly

the opposite   generate() method produces Zend/PEAR standard compliant

object oriented code   Target use case: Assisting RAD and facilitating iterative

development

| Jul-1-09 Advanced Usage | 23

Page 24: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Iterative Development   Use Zend_Tool to generate file & class   Modify file with external tool

•  Example: use studio to fill in the body of an Action Controllers action

  Use Zend_Tool to modify file & class •  Example: adding an action to an already generated and modifed

Action Controller

| Jul-1-09 Advanced Usage | 24

Page 25: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Next slides are old demonstration •  API still applicable, substitute Zend for ZendL

| Jul-1-09 Advanced Usage | 25

Page 26: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Zend_CodeGenerator / Reflection example

| Jul-1-09 Advanced Usage | 26

Page 27: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Zend_CodeGenerator / Reflection example

| Jul-1-09 Advanced Usage | 27

Page 28: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Zend_CodeGenerator / Reflection example

| Jul-1-09 Advanced Usage | 28

Page 29: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Zend_CodeGenerator / Reflection example

| Jul-1-09 Advanced Usage | 29

Page 30: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

•  Lets explore a simple problem: Db Table & Model Generation   Start with a schema   Generate Db Table Files   Generate Model Files

| Jul-1-09 Advanced Usage | 30

Page 31: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 31

Page 32: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 32

•  Files needed to facilitate this endeavor •  (These are in the include_path)

Page 33: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 33

Page 34: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 34

•  Start with the simpler Abstract & ModelProvider

Page 35: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 35

Page 36: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 36

Page 37: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 37

Page 38: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 38

Page 39: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 39

Page 40: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 40

Page 41: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 41

Page 42: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 42

•  The more complex DbTable provider & generator •  This will include some Zend_Application

integration

Page 43: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 43

Page 44: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 44

Page 45: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 45

Page 46: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 46

Page 47: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 47

Page 48: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 48

Page 49: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 49

Page 50: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 50

Page 51: Zend_Tool In ZF 1.8 Webinar

Advanced Usage

| Jul-1-09 Advanced Usage | 51

Page 52: Zend_Tool In ZF 1.8 Webinar

“ WRAPPING IT UP

What’s next? Wha’ts on the horizon?

| Jul-1-09 Advanced Usage | 52

Page 53: Zend_Tool In ZF 1.8 Webinar

Wrapping It Up

•  Most immediately   Code and slides published to my blog

•  http://ralphschindler.com   End of week a tutorial on DevZone

•  Same code, only heavily documented to demonstrate what is going on

•  Some additional functionality inside the code •  Iterative examples

| Jul-1-09 Name of this section | 53

Page 54: Zend_Tool In ZF 1.8 Webinar

Wrapping It Up

•  Whats to come in 1.9?   A setup script   Better include_path management   New Providers!

•  Model provider •  DbTable provides

  Custom profiles

•  Whats on the TODO list?   Importing of existing project (resource auto-detection)   Web based client   Zend Studio client

| Jul-1-09 Name of this section | 54

Page 55: Zend_Tool In ZF 1.8 Webinar

Wrapping It Up

•  Questions?

| Jul-1-09 Name of this section | 55

Page 56: Zend_Tool In ZF 1.8 Webinar

Copyright © 2007, Zend Technologies Inc.

THANK YOU! Ralph Schindler [email protected] http://framework.zend.com/

| Jul-1-09 Name of this section | 56