This repository has been archived by the owner on Aug 29, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding separate readme files for client and server
- Loading branch information
Showing
2 changed files
with
34 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |