PHP Classes

ZF DB Table Class Generator: Create Zend DB Table classes dynamically

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 196 This week: 1All time: 8,513 This week: 560Up
Version License PHP version Categories
app_model_database 1.0.0GNU General Publi...5.3PHP 5, Databases, Libraries
Description 

Author

This class can create Zend Framework DB Table classes dynamically.

It dynamically generate code for a concrete class that extends the Zend_Db_Table_Abstract just from a few parameters that defined the table name, the name of the class to be generated and its namespace.

The class returns an object of the just created class.

Innovation Award
PHP Programming Innovation award nominee
August 2015
Number 9


Prize: One subscription to the PDF edition of the PHP Architect magazine
Zend Framework provides a database access table class that applications can use to query application database tables.

This database table class is abstract. Therefore applications need to create individual extension classes for each table they need to access.

This class provides a simpler solution by dynamically creating database table classes for the tables you need to access. This way you avoid having to create separate class files for all the tables you use in your application.

Manuel Lemos
Picture of Martin Barker
  Performance   Level  
Name: Martin Barker <contact>
Classes: 14 packages by
Country: United Kingdom
Age: 34
All time rank: 29514 in United Kingdom
Week rank: 411 Down12 in United Kingdom Up
Innovation award
Innovation award
Nominee: 2x

Example

<?php

class IndexController extends Zend_Controller_Action
{
    public function
indexAction()
    {
       
$table = Application_Model_Database::GetInstance()->getTable("settings");
       
$rows = $table->fetch(
           
$table->select()
                ->
where(array("`name` = :name"))
                ->
bind(array(":name" => "title"))
        );
       
$this->view->title = $row[0];
    }
}


  Files folder image Files  
File Role Description
Files folder imagecontrollers (1 file)
Files folder imagemodels (2 files)

  Files folder image Files  /  controllers  
File Role Description
  Plain text file IndexController.php Example Example of how to use Database table loader class

  Files folder image Files  /  models  
File Role Description
  Plain text file Database.php Class Main Class ZendFramework 1 Model
  Plain text file Singleton.php Class Singleton Base Class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:196
This week:1
All time:8,513
This week:560Up