Recommend this page to a friend! |
![]() ![]() |
Info | ![]() |
![]() ![]() |
Reputation | Support forum (1) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2021-11-07 (6 months ago) ![]() | Not yet rated by the users | Total: 525 | All time: 5,646 This week: 429![]() |
Version | License | PHP version | Categories | |||
pgtable 1.0 | GNU General Publi... | 5.3.0 | PHP 5, Databases, Design Patterns |
Description | Author | ||||||||||||||||||||||
This class can map objects to MySQL records using ActiveRecord design pattern. |
|
PGTable A 'pretty good' activerecord style mysql abstraction lib for php. ========= Requirements: - Php version >= 5.3.0 - Mysql (No mysqli or PDO requirement) - Tables must bave an id primary key as int auto_increment ```php require 'pgtable.php'; class Product extends PGTable{ public static $table_name = 'products'; } PGTable::initialize('username', 'password', 'database', 'host'); foreach(Product::all() as $product){ echo $product->attributes['name'] . "\n"; } ``` Magic methods: these don't need to be defined ```php $product = Product::find_by_foo_and_bar; $products = Product::find_all_by_foo_and_bar; ``` Check for duplicate before saving ```php $product = Product::find_by_unique_id($unique_id); if(!$product) $product = new Product(); $product->update_attributes(array('name' => 'foo', 'price' => '9.95')); $product->save(); ``` |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Comments (1) | |||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.