Login   Register  
PHP Classes
elePHPant
Icontem

File: simpleObjectDB2/example/step5-changeObject.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ilya Nemihin  >  simpleObjectDB  >  simpleObjectDB2/example/step5-changeObject.php  >  Download  
File: simpleObjectDB2/example/step5-changeObject.php
Role: Example script
Content type: text/plain
Description: step5-changeObject
Class: simpleObjectDB
simple object database
Author: By
Last change:
Date: 2003-06-17 14:05
Size: 1,184 bytes
 

Contents

Class file image Download
<?php

//---[ simpleObjectDB ]---
// demo-step-5 "change"
//
// change fields of object person1 and
// save object's state back to persistence system
// ps: you can run this script repeatable ;)
//

$include_root '../include/';
require_once( 
$include_root 'functions/ClassLoader.php' );
load_class'PersistenceSystem/PersistenceSystem.php' );

$initParams = array();
$initParams["storageRoot"] = 'root2/';

$oid 'root:person1';

// initialize
$persistenceSystem = new PersistenceSystem$initParams );

// get object
$object1 $persistenceSystem->getObject$oid );

// show fields
print "field 'name': ["$object1->getField('name') ."]\n";
print 
"field 'IQ': ["$object1->getField('IQ') ."]\n";

// change fields
$object1->setField'name''ilya' );
$object1->setField'IQ'$object1->getField('IQ') + );

// save object
$object1->save();


// get object again
$object2 $persistenceSystem->getObject$oid );

// show fields
print "after changes:\n";
print 
"field 'name': ["$object2->getField('name') ."]\n";
print 
"field 'IQ': ["$object2->getField('IQ') ."]\n";
print 
"salary: ["$object2->getSalary() ."]\n";


?>