forked from doctrine/rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.php
38 lines (29 loc) · 905 Bytes
/
client.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require '/Users/jwage/Sites/doctrine2git/lib/Doctrine/Common/ClassLoader.php';
use Doctrine\REST\Client\Client,
Doctrine\REST\Client\EntityConfiguration,
Doctrine\REST\Client\Manager,
Doctrine\REST\Client\Entity,
Doctrine\Common\ClassLoader;
$classLoader = new ClassLoader('Doctrine\REST', __DIR__ . '/lib');
$classLoader->register();
$client = new Client();
$manager = new Manager($client);
$manager->registerEntity('User');
Entity::setManager($manager);
class User extends Entity
{
public $id;
public $username;
public $password;
public static function configure(EntityConfiguration $entityConfiguration)
{
$entityConfiguration->setUrl('http://localhost/rest/server.php');
$entityConfiguration->setName('user');
}
}
$user = User::find(9);
$user->username = 'teetertertsting';
$user->password = 'w00t';
$user->save();
print_r($user);