PHP Classes

File: example/save.php

Recommend this page to a friend!
  Classes of Hugo Ferreira da Silva   Lumine   example/save.php   Download  
File: example/save.php
Role: Example script
Content type: text/plain
Description: How to save multiples objects in a single save() call
Class: Lumine
Object-relational mapping tool
Author: By
Last change:
Date: 19 years ago
Size: 700 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");
Util::import("com.domain.classes.Car");

$person = new Person;

$car1 = new Car;
$car2 = new Car;

$person->name = 'John';
$person->eyecolor = 'Blue';
$person->age = 24;

$car1->color = 'Red';
$car1->model = 'Verona';

$car2->color = 'Black';
$car2->model = 'Vectra';

/** inserts the two new cars in the new person. Lumine automatically saves everything */
$person->cars[] = &$car1;
$person->cars[] = &$car2;

$person->save();
?>