Login   Register  
PHP Classes
elePHPant
Icontem

File: demo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Liber Fernández Gribov  >  Liber ORM  >  demo.php  >  Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Liber ORM
Store and retrieve objects from database records
Author: By
Last change:
Date: 2010-06-04 17:55
Size: 1,094 bytes
 

Contents

Class file image Download
<?php
//English: All the comments are first in english then in spanish
//Español: Todos los comentarios están primero en inglés y luego en español
include_once("class.ORM.php");
include_once(
"config.ORM.php");
include_once(
"class.Map.php");
include_once(
"class.Driver.php");
include_once(
"class.MySQL_Driver.php");
include_once(
"class.Dummy_Map.php");
include_once(
"class.Dummy.php");
//Creating a dummy object
//Creando un objeto tonto
$dummy  = new Dummy(1"A","B","C","D");
$driver = new MySQL_Driver();
$driver->set_debug(true);
ORM::set_driver($driver);
//Inserting 3 Dummy objects. 
//Insertando 3 objetos tontos
ORM::insert($dummy);
$dummy->set_id(2);
ORM::insert($dummy);
$dummy->set_id(3);
ORM::insert($dummy);
//Loading the second one...
//Cargando el segundo objeto
$dummy->set_id(2);
ORM::load($dummy);
//Updating the second one...
//Actualizando el segundo...
$dummy->set_field_1("E");
$dummy->set_field_2("F");
$dummy->set_field_3("G");
$dummy->set_field_4("H");
ORM::update($dummy);
//Deleting the last one...
//Eliminando el último...
$dummy->set_id(3);
ORM::delete($dummy);
?>