Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Wrong variable at StandartResponseTransformer #1

Merged
merged 2 commits into from

2 participants

Alexandre Eher Jonathan H. Wage
Alexandre Eher

The method jsonToArray receive a $json parameter, but the json decode was using a $data variable.

Jonathan H. Wage jwage merged commit 38824c0 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 18, 2011
  1. Fix a wrong variable

    Eher authored
Commits on Jun 20, 2011
This page is out of date. Refresh to see the latest.
4 lib/Doctrine/REST/Client/ResponseTransformer/StandardResponseTransformer.php
View
@@ -77,6 +77,6 @@ public function xmlToArray($object, &$array = array())
public function jsonToArray($json)
{
- return (array) json_decode($data);
+ return (array) json_decode($json);
}
-}
+}
46 lib/Doctrine/REST/Client/URLGenerator/ApontadorURLGenerator.php
View
@@ -0,0 +1,46 @@
+<?php
+
+namespace Doctrine\REST\Client\URLGenerator;
+
+/**
+ * Apontador REST request URL generator
+ *
+ * @author Alexandre Eher <alexandre@eher.com.br>
+ */
+class ApontadorURLGenerator extends AbstractURLGenerator
+{
+ public function generate(array $options)
+ {
+ $id = isset($options['id']) ? $options['id'] : null;
+ $action = isset($options['action']) ? $options['action'] : null;
+ $parameters = isset($options['parameters']) ? $options['parameters'] : array();
+
+ $parameters['type'] = $this->_entityConfiguration->getResponseType();
+ if ($id)
+ {
+ if ($action !== null)
+ {
+ $path = sprintf('/%s/%s', $id, $action);
+ } else {
+ $path = sprintf('/%s', $id);
+ }
+ } else {
+ if ($action !== null)
+ {
+ $path = sprintf('/%s', $action);
+ } else {
+ $path = '';
+ }
+ }
+ $url = $this->_entityConfiguration->getUrl() . '/' . $this->_entityConfiguration->getName() . $path;
+ if (is_array($parameters) && $parameters) {
+ foreach ($this->_entityConfiguration->getProperties() as $field) {
+ unset($parameters[$field]);
+ }
+ if ($parameters) {
+ $url .= '?' . http_build_query($parameters);
+ }
+ }
+ return $url;
+ }
+}
Something went wrong with that request. Please try again.