Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Adding separate readme files for client and server
Browse files Browse the repository at this point in the history
  • Loading branch information
jwage committed Apr 6, 2010
1 parent 78c1849 commit 6ac9bd7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
39 changes: 3 additions & 36 deletions README.markdown → lib/Doctrine/REST/Client/README.markdown
@@ -1,7 +1,6 @@
# Doctrine 2 REST Server and Client
# Doctrine REST Client

The Doctrine 2 REST server and client component is both an easy way to spin up
REST services for your Doctrine 2 entities as well as a way to work with REST
The Doctrine 2 REST client component is a way to work with REST
services via an ActiveRecord style implementation similiar to ActiveResource in
Ruby on Rails!

Expand Down Expand Up @@ -75,36 +74,4 @@ We can retrieve that person again now:

Or you can retrieve all Person objects:

$persons = Person::findAll();

## Server

The Doctrine 2 REST server allows you to easily expose your entities through some
REST services. This is the raw low level server and does not include any routing
or URL parsing so you would need to implement in some existing framework that
has routing like Symfony or Zend Framework.

All you need to do is create a new REST server instance and pass it the instance
of your EntityManager you want to expose the entities for and an array representing
the server request you want to process:

$request = array(
'_method' => 'get',
'_format' => 'xml',
'_entity' => 'user',
'_action' => 'get',
'_id' => 1
);

$server = new \Doctrine\REST\Server\Server($em, $request);
$server->addEntityAlias('Entities\User', 'user');

$xml = $server->execute();

The above would retrieve the User with the id of 1 and return an XML document
like the following:

<user>
<id>1</id>
<username>jwage</username>
</user>
$persons = Person::findAll();
31 changes: 31 additions & 0 deletions lib/Doctrine/REST/Server/README.markdown
@@ -0,0 +1,31 @@
# Doctrine REST Server

The Doctrine 2 REST server allows you to easily expose your entities through some
REST services. This is the raw low level server and does not include any routing
or URL parsing so you would need to implement in some existing framework that
has routing like Symfony or Zend Framework.

All you need to do is create a new REST server instance and pass it the instance
of your EntityManager you want to expose the entities for and an array representing
the server request you want to process:

$request = array(
'_method' => 'get',
'_format' => 'xml',
'_entity' => 'user',
'_action' => 'get',
'_id' => 1
);

$server = new \Doctrine\REST\Server\Server($em, $request);
$server->addEntityAlias('Entities\User', 'user');

$xml = $server->execute();

The above would retrieve the User with the id of 1 and return an XML document
like the following:

<user>
<id>1</id>
<username>jwage</username>
</user>

0 comments on commit 6ac9bd7

Please sign in to comment.