Skip to content
This repository
Browse code

Merge pull request #19 from mgrandi/master

bug fixes
  • Loading branch information...
commit 572382a591b4e3944b8165b4d12a340034cbe6e0 2 parents 2299cc7 + 282ce03
Jonathan Moss authored
7 src/bootstrap.php
@@ -41,6 +41,11 @@ class MorphAutoloader
41 41 'morph\\property\\ComposeOne' => 'phar://Morph/property/ComposeOne.php',
42 42 'morph\\property\\String' => 'phar://Morph/property/String.php',
43 43 'morph\\property\\Generic' => 'phar://Morph/property/Generic.php',
  44 + 'morph\\property\\Boolean' => 'phar://Morph/property/Boolean.php',
  45 + 'morph\\property\\BinaryData' => 'phar://Morph/property/BinaryData.php',
  46 + 'morph\\property\\Integer32' => 'phar://Morph/property/Integer32.php',
  47 + 'morph\\property\\Integer64' => 'phar://Morph/property/Integer64.php',
  48 + 'morph\\property\\Regex' => 'phar://Morph/property/Regex.php',
44 49 'morph\\query\\Property' => 'phar://Morph/query/Property.php',
45 50 'morph\\format\\Collection' => 'phar://Morph/format/Collection.php',
46 51 'morph\\exception\\ObjectNotFound' => 'phar://Morph/exception/ObjectNotFound.php',
@@ -67,4 +72,4 @@ public static function load($className)
67 72 //register the autoloader
68 73 spl_autoload_register(array('MorphAutoloader', 'load'));
69 74
70   -__HALT_COMPILER();
  75 +__HALT_COMPILER();
8 src/morph/Object.php
@@ -286,13 +286,19 @@ public function delete()
286 286 */
287 287 public function __toString()
288 288 {
  289 + // create the array that we will be encoding and returning
  290 + // also put inside the array the mongodb ID and the 'state'
289 291 $data = array(
290 292 'Id' => $this->id(),
291 293 'State' => $this->state()
292 294 );
  295 +
  296 + // iterate through all the properties this object has and print them out
293 297 foreach ($this->propertySet as $name => $property) {
  298 +
294 299 $data[$name] = (string)$property;
295   - }
  300 + }
  301 +
296 302 return \json_encode($data);
297 303 }
298 304
15 src/morph/property/BinaryData.php
@@ -86,4 +86,19 @@ public function __setRawValue($value)
86 86 return $this;
87 87 }
88 88
  89 +
  90 + /**
  91 + * Returns the base64 encoding of the binary data
  92 + *
  93 + * @return String
  94 + */
  95 + public function __toString()
  96 + {
  97 +
  98 + // we return the base64 encoding of the binary data because
  99 + // json does not have a native way to represent binary data
  100 + return base64_encode($this->value);
  101 +
  102 + }
  103 +
89 104 }

0 comments on commit 572382a

Please sign in to comment.
Something went wrong with that request. Please try again.