@@ -14,6 +14,7 @@ class Factory implements FactoryInterface {
1414 'user ' => '\EclipseGc\DrupalOrg\Api\Resources\User ' ,
1515 'node ' => '\EclipseGc\DrupalOrg\Api\Resources\Node ' ,
1616 'taxonomy_term ' => '\EclipseGc\DrupalOrg\Api\Resources\TaxonomyTerm ' ,
17+ 'project_issue ' => '\EclipseGc\DrupalOrg\Api\Resources\Node\ProjectIssue ' ,
1718 );
1819
1920 function __construct (Client $ client ) {
@@ -29,6 +30,7 @@ public function getObjectTypeClass($type, array $data) {
2930 }
3031
3132 public function createObjectType ($ type , array $ data = array ()) {
33+ $ data = (isset ($ data ['list ' ])) ? $ data ['list ' ][0 ] : $ data ;
3234 $ objectClass = $ this ->getObjectTypeClass ($ type , $ data );
3335 $ reflector = new \ReflectionClass ($ objectClass );
3436 if (!isset ($ data ['factory ' ])) {
@@ -51,7 +53,14 @@ public function createObjectType($type, array $data = array()) {
5153 * @throws \Exception
5254 */
5355 public function request ($ entity_type , $ id ) {
54- $ request = $ this ->client ()->get (['{entity_type}/{id} ' , ['entity_type ' => $ entity_type , 'id ' => $ id ]]);
56+ switch ($ entity_type ) {
57+ case 'project_issue ' :
58+ $ request = $ this ->client ()->get (['node.json?type={entity_type}&nid={id} ' , ['entity_type ' => $ entity_type , 'id ' => $ id ]]);
59+ break ;
60+ default :
61+ $ request = $ this ->client ()->get (['{entity_type}/{id} ' , ['entity_type ' => $ entity_type , 'id ' => $ id ]]);
62+ break ;
63+ }
5564 if ($ request ->getStatusCode () != 200 ) {
5665 throw new \Exception (sprintf ('Status code was not OK. %d returned instead. ' , $ request ->getStatusCode ()));
5766 }
@@ -76,4 +85,4 @@ protected function client(Client $new_client = NULL) {
7685 return $ client ;
7786 }
7887
79- }
88+ }
0 commit comments