Phalcon\Mvc\MongoCollection::findById PHP Method

findById() public static method

public static findById ( $id )
    public static function findById($id)
    {
        if (!is_object($id)) {
            $classname = get_called_class();
            $collection = new $classname();
            /** @var MongoCollection $collection */
            if ($collection->getCollectionManager()->isUsingImplicitObjectIds($collection)) {
                $mongoId = new ObjectID($id);
            } else {
                $mongoId = $id;
            }
        } else {
            $mongoId = $id;
        }
        return static::findFirst([["_id" => $mongoId]]);
    }