PHP Classes

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

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 196 All time: 8,519 This week: 455Up
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: 35
All time rank: 29414 in United Kingdom
Week rank: 164 Up6 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 (3)  
File Role Description
Files folder imagecontrollers (1 file)
Files folder imagemodels (2 files)

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

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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:196
This week:0
All time:8,519
This week:455Up