PHP Classes

File: README

Recommend this page to a friend!
  Classes of Nguyen Duc Thuan   Zodeken - Code generator for Zend Framework   README   Download  
File: README
Role: Documentation
Content type: text/plain
Description: Instructions
Class: Zodeken - Code generator for Zend Framework
Generate code to access MySQL with Zend Framework
Author: By
Last change: 1.2.0 (March 25, 2012)
- Added basic CRUD actions including create, read, update, delete forms
- A grid comes with basic search, filter features
- Pagination
- Column (ENUM/SET, linked field) filter
- Multiple deletion
- Sorting
- Added getDbSelectByParams() function to table-abstract that used by the grid
- Added getZodekenAutoLabel() function to row-abstract that returns value of
the field that has been automatically guessed as the label
- Added ->setValue(date(...)) to datetime, time, timestamp fields of forms
- Generated code is separated into templates for easy modifications
- Added an option that allows overriding existing files
- Zend_Form is set as the default forms' parent class
Date: 10 years ago
Size: 3,329 bytes
 

Contents

Class file image Download
*** FEATURES *** - Supports only MySQL. - Generates Controllers with CRUD actions, Db_Tables, DbTable_Rows, DbTable_Rowsets with DocBlock tags that gives you autocompletion when coding in an IDE. - Defines Db_Table's $_dependentTables and $_referenceMap following InnoDB's relationships. - Adds some commonly used methods to Db_Table: fetchPairs (an array of key => value pairs), fetchOne (value of first column's first field), fetchOnes (an array that is a list of fetchOne). - You are free to add custom methods to Db_Table, Row, Rowset, Form or Mapper. Basic methods like fetchOne(), fetchPairs(), fetchOnes(), setters, getters... are added to abstract classes of them. Those abstract class files will be overwritten when you re-run the generator. With forms, latest Zodeken-generated classes will be put in (Application_)Form_Edit[TableName]_Latest, you can compare this with current version (Application_)Form_Edit[TableName] to add or change the code as necessary to it. - Detects the relationships between the tables and generates basically necessary methods. One-to-many: $memberRow->getPostRowsetByAuthorId() $postRow->getMemberRowByAuthorId() Many-to-many: $tagRow->getPostRows() $postRow->getTagRows() - Uses proper form element for each data type. For example: enum/set -> radio varchar/char -> text text/longtext -> textarea foreign key -> select ... - Adds validators and filters depending on data type of the field. For example: InArray for ENUM/SET Int for INT Float for BIGINT/DECIMAL/FLOAT ->setRequired(true) for 'NOT NULL' fields StringLength(array('max' => 100)) for fields that have 100 char. limit - Adds a drop-down list for a foreign key field to the form: $tableCategory = new Application_Model_Category_DbTable(); $this->addElement( $this->createElement('select', 'category_id') ->setLabel('Category Id') ->setMultiOptions(array("" => "- - Select - -") + $tableCategory->fetchPairs()) ->setRequired(true) ->setDecorators($this->elementDecorators) ); *** INSTALLATION *** 1. Download latest version from http://code.google.com/p/zodeken/downloads/list 2. Place the folder Zodeken into a folder that covered by your include_path setting. Or simply, just place Zodeken into the same folder with your Zend library, for example: /usr/share/php/ Zend/ Zodeken/ 3. Edit your .zf.ini (usually located at your home folder), append this line: basicloader.classes.20 = "Zodeken_ZfTool_ZodekenProvider" You may change the number 20 to another one that you prefer. If don't know where that file is located, you may run: zf --setup config-file or zf create config The command 'zf' not found??? Read this first: http://framework.zend.com/manual/en/zend.tool.framework.clitool.html 4. Done *** USAGE *** 1. Create the project using zf command line tool zf create project zfproject 2. "chdir" to the created project folder cd zfproject 3. Configure database settings in the application.ini file zf configure db-adapter [...] 4. Run the command zf generate zodeken 5. Done *** TEST *** 1. Create a database 2. Import ZodekenTest.sql 3. Do steps as in "USAGE" section