PHP Classes
elePHPant
Icontem

File: example/retrieve.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Hugo Ferreira da Silva  >  Lumine  >  example/retrieve.php  >  Download  
File: example/retrieve.php
Role: Example script
Content type: text/plain
Description: How to retrive objects from database
Class: Lumine
Object-relational mapping tool
Author: By
Last change:
Date: 9 years ago
Size: 651 bytes
 

Contents

Class file image Download
<?php

require_once '../lumine/LumineConfiguration.php';
$conf = new LumineConfiguration("lumine-conf.xml");

/* show up whats happen */
// LumineLog::setLevel(4);
// LumineLog::setOutput('browser');

Util::import("com.domain.classes.Person");

/**
* in this example, the array cars automatically will fillin because in the relationship map
* of entity Person, has the lazy attribute set to true
*/
$person = new Person;
if(
$person->get( 10 ) > 0) {
    echo
$person->name . " has the following car(s):<br />\r\n";
    foreach(
$person->cars as $car) {
        echo
"-- " . $car->model . ", wich is " . $car->color . "<br />\r\n";
    }
}

?>