2016-03-28 5 views
3

DoctrineデータベースとしてREST APIを使用できますか?DoctrineをREST APIで使用する

http://doctrine-orm.readthedocs.org/projects/doctrine-dbal/en/latest/reference/configuration.htmlの設定については、「ドライバ」プロパティを変更できます。

しかし、許可されたドライバのリストには、REST APIを使用する人はいません。

私は何をしたいのです:

<?php 
$config = new \Doctrine\DBAL\Configuration(); 
//.. 
$connectionParams = array(
    'dbname' => 'my_rest_api', 
    'user' => 'user', 
    'password' => 'secret', 
    'host' => 'localhost:3000', 
    'driver' => 'rest', 
); 
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config); 

$entityManager = EntityManager::create($conn, $config); 

// Sends a GET request to localhost:3000/myentity/1 and maps it properly to my configured entity 
$entity = $entityManager->find("MyNamespace\Entity\MyEntity", 1); 

// Sends a POST request to localhost:3000/myentity 
$entity = new MyEntity(); 
$entityManager->persist($entity); 
$entityManager->flush(); 

// and so on 

は、あなたの答えをありがとう!

答えて

関連する問題