コード例 #1
0
ファイル: MongoService.php プロジェクト: ppetermann/king23
 /**
  * conveniant method to create new instances
  * @param string $collection
  * @return MongoObject
  */
 public function newObject($collection)
 {
     /** @var MongoObject $obj */
     $obj = $this->container->getInstanceOf($this->classMap->getClassForResult($collection, []));
     $obj->setCollection($collection);
     return $obj;
 }
コード例 #2
0
ファイル: Result.php プロジェクト: ppetermann/king23
 /**
  * Iterator::current
  * return current specific object
  *
  * @return MongoObject
  * @throws Exception
  */
 public function current()
 {
     $documentData = $this->myResultCursor->current();
     /** @var MongoObject $document */
     $document = $this->container->getInstanceOf($this->classMapInterface->getClassForResult($this->collection, $documentData));
     $document->setCollection($this->collection);
     $document->loadFromArray($documentData);
     return $document;
 }