<?php  
//main class to extend usage 
require 'remodel.php'; 
 
//loading library predis: https://github.com/nrk/predis 
require 'predis-0.8/autoload.php'; 
Predis\Autoloader::register(); 
 
///MODEL EXAMPLE 
class Model_Post extends Remodel { 
 
    protected $_table_name  = 'posts'; 
    protected $_primary_key = 'id_post'; 
 
    //NOT MANDATORY but recommended 
    protected $_fields = array( 'id_post', 
                                'title', 
                                'description', 
                                'created', 
                                'status',         
                                ); 
} 
 
//CREATE: 
$post = new Model_Post(); 
$post->title         = 'test title'.time(); 
$post->description     = 'test description'; 
$post->created         = time(); 
$post->status         = 1; 
 
$post->save(); 
 
print_r($post->values()); 
 
//GET an specific model  
$post = new Model_Post(); 
$post->load(1); 
print_r($post->values()); 
 
//UPDATE current needs to be loaded before 
$post->title  = 'title updated'; 
$post->status = 0; 
$post->save(); 
print_r($post->values()); 
 
//DELETE current 
$post->delete(); 
 
//GET many 
$post  = new Model_Post(); 
$posts = $post->select(0,3); 
foreach ($posts as $p)  
    print_r($p->values()); 
 
 
 |