1
0
mirror of synced 2025-01-18 22:41:43 +03:00
doctrine2/playground/index.php

74 lines
1.7 KiB
PHP
Raw Normal View History

2007-09-13 16:55:32 +00:00
<?php
2007-09-19 16:26:28 +00:00
require_once('playground.php');
2007-09-25 14:09:05 +00:00
$action = isset($_REQUEST['action']) ? $_REQUEST['action']:'client';
if ($action == 'server') {
require_once('connection.php');
require_once('models.php');
require_once('data.php');
$name = 'Doctrine_Resource_Playground';
$config = array('models' => $tables);
$server = Doctrine_Resource_Server::getInstance($name, $config);
$server->run($_REQUEST);
} else {
$url = 'http://localhost/~jwage/doctrine_trunk/playground/index.php?action=server';
$config = array();
// Instantiate a new client
$client = Doctrine_Resource_Client::getInstance($url, $config);
$query = new Doctrine_Resource_Query();
$users = $query->from('User u, u.Group g')->execute();
2007-09-25 14:09:05 +00:00
print_r($users->toArray(true));
2007-09-25 14:09:05 +00:00
/*
$group = new Group();
$group->name = 'Jon';
$group->save();
2007-09-25 14:09:05 +00:00
print_r($group->toArray());
*/
2007-09-25 14:09:05 +00:00
//$client->printSchema();
2007-09-25 14:09:05 +00:00
/*
// Retrieve a models table object
$table = $client->getTable('User');
2007-09-25 14:09:05 +00:00
$user = new User();
$user->name = 'Jon Wage';
2007-09-25 14:09:05 +00:00
$user->Email->address = 'jonwage@gmail.com';
2007-09-25 14:09:05 +00:00
$phone = $user->Phonenumber[0];
$phone->phonenumber = '555-5555';
$phone = $user->Phonenumber[1];
$phone->phonenumber = '555-55555';
$user->Phonenumber[2]->phonenumber = '555';
$user->Account->amount = 50.00;
$user->Account->amount = 25.25;
$address = $user->Address[0];
$address->address = '112 2nd Ave North';
$album = $user->Album[0];
$album->name = 'test album';
$song = $album->Song[0];
$song->title = 'test author';
$user->save();
print_r($user->toArray(true));
2007-09-25 14:09:05 +00:00
*/
}