/** * Generates an object reference for Has* properties * * @param $object * @return array */ public static function objectReference(Morph_Object $object) { $reference = array('$ref' => $object->collection(), '$id' => $object->id()); //causes a fatal error in PHP at present. Will try again later //$reference = MorphDBRef::create($object->collection(), $object->id()); return $reference; }
/** * (non-PHPdoc) * @see tao/classes/Morph/property/Morph_Property_Generic#__toString() */ public function __toString() { $id = ''; if(isset($this->value)){ $id = $this->value->id(); }elseif(isset($this->reference)){ $id = $this->reference['$id']; } return $this->getName() . ": {" . $this->type . ": $id}"; }
/** * Deletes the object passed in from the database * @param Morph_Object $object * @return boolean */ public function delete(Morph_Object $object) { $query = array('_id' => $object->id()); return $this->Db->selectCollection($object->collection())->remove($query, true); }