Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fetchAll helper

  • Loading branch information...
commit a5a2d94ea46edd30edd221c77f9b771dc5af87f1 1 parent 16dabcb
@kkamkou kkamkou authored
Showing with 22 additions and 12 deletions.
  1. +18 −8 src/morph/Object.php
  2. +4 −4 src/morph/Storage.php
View
26 src/morph/Object.php
@@ -145,7 +145,7 @@ public function __getData()
}
return $data;
}
-
+
/**
* @return \morph\PropertSet
*/
@@ -222,7 +222,7 @@ public function loadById($id)
/**
* Fetch multiple objects by their ids
- *
+ *
* By default Morph sets the id to be an instance of MongoId(). When searching you need
* to ensure you do the same by wrapping your id string in a MongoId object
*
@@ -233,12 +233,12 @@ public function findByIds(array $ids)
{
return Storage::instance()->fetchByIds($this, $ids);
}
-
+
/**
* Find objects by query
*
- * @param Morph_IQuery $query
- * @return Morph_Iterator
+ * @param IQuery $query
+ * @return \morph\Iterator
*/
public function findByQuery(IQuery $query)
{
@@ -248,8 +248,8 @@ public function findByQuery(IQuery $query)
/**
* Finds one object by query
*
- * @param Morph_Query $query
- * @return Morph_Object
+ * @param IQuery $query
+ * @return Object
*/
public function findOneByQuery(IQuery $query)
{
@@ -257,8 +257,18 @@ public function findOneByQuery(IQuery $query)
}
/**
+ * Returns all entries for the current document
+ *
+ * @return \morph\Iterator
+ */
+ public function fetchAll()
+ {
+ return Storage::instance()->findByQuery($this);
+ }
+
+ /**
* Deletes this object from the database
- *
+ *
* @return boolean
*/
public function delete()
View
8 src/morph/Storage.php
@@ -211,11 +211,11 @@ public function delete(Object $object)
/**
* Runs query against the database
*
- * The results come packages up in a Morph_Iterator object
+ * The results come packages up in a \morph\Iterator object
*
- * @param \morph\Object $object Required to determine the correct collection query against
- * @param Morph_IQuery $query
- * @return Morph_Iterator
+ * @param Object $object Required to determine the correct collection query against
+ * @param IQuery $query
+ * @return \morph\Iterator
*/
public function findByQuery(Object $object, IQuery $query = null)
{
Please sign in to comment.
Something went wrong with that request. Please try again.