src/Mongo/MongoService.php
public function getByCriteria($collection, $criteria)
    {
        if ($data = $this->findOne($collection, $criteria)) {

            /** @var MongoObject $obj */
            $obj = $this->container->get(
                $this->classMap->getClassForResult($collection, $data)
            );
            $obj->setCollection($collection);
            $obj->loadFromArray($data);

            return $obj;
        }

        return null;
    }
public function getByCriteria($collection, $criteria)
    {
        if ($data = $this->findOne($collection, $criteria)) {

            /** @var MongoObject $obj */
            $obj = $this->container->get(
                $this->classMap->getClassForResult($collection, $data)
            );
            $obj->setCollection($collection);
            $obj->loadFromArray($data);

            return $obj;
        }

        return null;
    }
public function getByCriteria ( $ collection , $ criteria ) { if ( $ data = $ this -> findOne ( $ collection , $ criteria ) ) { /** @var MongoObject $obj */ $ obj = $ this -> container -> get ( $ this -> classMap -> getClassForResult ( $ collection , $ data ) ) ; $ obj -> setCollection ( $ collection ) ; $ obj -> loadFromArray ( $ data ) ; return $ obj ; } return null ; }
convenience method to retrieve object by criteria, should be used in
public static method by the derived class

@param string $collection
@param  array $criteria
@return MongoObject
@throws \MongoException
convenience method to retrieve object by criteria should be used in public static method by the derived class