Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #19 from mgrandi/master

bug fixes
  • Loading branch information...
commit 572382a591b4e3944b8165b4d12a340034cbe6e0 2 parents 2299cc7 + 282ce03
Jonathan Moss authored
View
7 src/bootstrap.php
@@ -41,6 +41,11 @@ class MorphAutoloader
'morph\\property\\ComposeOne' => 'phar://Morph/property/ComposeOne.php',
'morph\\property\\String' => 'phar://Morph/property/String.php',
'morph\\property\\Generic' => 'phar://Morph/property/Generic.php',
+ 'morph\\property\\Boolean' => 'phar://Morph/property/Boolean.php',
+ 'morph\\property\\BinaryData' => 'phar://Morph/property/BinaryData.php',
+ 'morph\\property\\Integer32' => 'phar://Morph/property/Integer32.php',
+ 'morph\\property\\Integer64' => 'phar://Morph/property/Integer64.php',
+ 'morph\\property\\Regex' => 'phar://Morph/property/Regex.php',
'morph\\query\\Property' => 'phar://Morph/query/Property.php',
'morph\\format\\Collection' => 'phar://Morph/format/Collection.php',
'morph\\exception\\ObjectNotFound' => 'phar://Morph/exception/ObjectNotFound.php',
@@ -67,4 +72,4 @@ public static function load($className)
//register the autoloader
spl_autoload_register(array('MorphAutoloader', 'load'));
-__HALT_COMPILER();
+__HALT_COMPILER();
View
8 src/morph/Object.php
@@ -286,13 +286,19 @@ public function delete()
*/
public function __toString()
{
+ // create the array that we will be encoding and returning
+ // also put inside the array the mongodb ID and the 'state'
$data = array(
'Id' => $this->id(),
'State' => $this->state()
);
+
+ // iterate through all the properties this object has and print them out
foreach ($this->propertySet as $name => $property) {
+
$data[$name] = (string)$property;
- }
+ }
+
return \json_encode($data);
}
View
15 src/morph/property/BinaryData.php
@@ -86,4 +86,19 @@ public function __setRawValue($value)
return $this;
}
+
+ /**
+ * Returns the base64 encoding of the binary data
+ *
+ * @return String
+ */
+ public function __toString()
+ {
+
+ // we return the base64 encoding of the binary data because
+ // json does not have a native way to represent binary data
+ return base64_encode($this->value);
+
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.