Skip to content

PHPLIB-186: Implement Manager accessors for core classes #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

PHPLIB-186: Implement Manager accessors for core classes #255

wants to merge 1 commit into from

Conversation

abellion
Copy link
Contributor

Could be useful to get the manager from the Database class to instantiate the Collection class with the same manager. Example :

<?php

namespace App\Users;

use MongoDB;

class Users extends MongoDB\Collection
{

    //Get the Database class from the dependency injection engine (just for the example)
    public function __construct(MongoDB\Database $mongoDB)
    {
        parent::construct(
            $mongoDB->getManager(),
            $mongoDB->getDatabaseName(),
            "users"
        );
    }

    //Can now decorate the collection with specific methods :)

}

@jmikola jmikola changed the title Add manager accessors PHPLIB-186: Implement Manager accessors for core classes Sep 28, 2016
jmikola added a commit that referenced this pull request Sep 28, 2016
@jmikola
Copy link
Member

jmikola commented Sep 28, 2016

Manually merged in b4ba7a7.

This was planned for some time in PHPLIB-186, but I had not gotten around to adding the methods. Thanks for the contribution!

@jmikola jmikola closed this Sep 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants