2007-09-13 16:55:32 +00:00
|
|
|
<?php
|
2007-09-19 16:26:28 +00:00
|
|
|
require_once('playground.php');
|
2007-09-22 01:32:48 +00:00
|
|
|
|
|
|
|
$action = isset($_REQUEST['action']) ? $_REQUEST['action']:'client';
|
|
|
|
|
|
|
|
if ($action == 'server') {
|
2007-09-24 21:32:02 +00:00
|
|
|
require_once('connection.php');
|
|
|
|
require_once('models.php');
|
|
|
|
require_once('data.php');
|
|
|
|
|
2007-09-24 04:58:57 +00:00
|
|
|
$config = array('name' => 'Doctrine_Resource_Test_Server',
|
|
|
|
'models' => $tables);
|
2007-09-22 01:32:48 +00:00
|
|
|
|
2007-09-24 04:58:57 +00:00
|
|
|
$server = Doctrine_Resource_Server::getInstance($config);
|
2007-09-22 01:32:48 +00:00
|
|
|
$server->run($_REQUEST);
|
2007-09-24 04:58:57 +00:00
|
|
|
|
2007-09-22 01:32:48 +00:00
|
|
|
} else {
|
2007-09-24 21:32:02 +00:00
|
|
|
$config = array('url' => 'http://localhost/~jwage/doctrine_trunk/playground/index.php?action=server');
|
2007-09-22 01:32:48 +00:00
|
|
|
|
2007-09-24 04:58:57 +00:00
|
|
|
$client = Doctrine_Resource_Client::getInstance($config);
|
2007-09-24 21:50:50 +00:00
|
|
|
$table = $client->getTable('User');
|
2007-09-24 04:58:57 +00:00
|
|
|
|
2007-09-24 21:50:50 +00:00
|
|
|
$user = $table->find(4);
|
2007-09-24 21:46:05 +00:00
|
|
|
$user->Phonenumber->add()->phonenumber = '555-5555';
|
2007-09-24 21:32:02 +00:00
|
|
|
$user->name = 'jonnwage';
|
2007-09-24 19:29:56 +00:00
|
|
|
$user->save();
|
2007-09-24 21:46:05 +00:00
|
|
|
|
|
|
|
print_r($user->toArray());
|
2007-09-22 01:32:48 +00:00
|
|
|
}
|