Skip to content
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

CollectionManager hard coded "mongo" string #11725

Closed
bkirova opened this issue Apr 29, 2016 · 2 comments
Closed

CollectionManager hard coded "mongo" string #11725

bkirova opened this issue Apr 29, 2016 · 2 comments
Labels
enhancement Enhancement to the framework

Comments

@bkirova
Copy link

bkirova commented Apr 29, 2016

public function getConnection(<CollectionInterface> model)
{
    var service, connectionService, connection, dependencyInjector, entityName;

    let service = "mongo";
    let connectionService = this->_connectionServices;
    if typeof connectionService == "array" {
        let entityName = get_class(model);

        /**
        * Check if the model has a custom connection service
        */
        if isset connectionService[entityName] {
            let service = connectionService[entityName];
        }
    }

    let dependencyInjector = this->_dependencyInjector;
    if typeof dependencyInjector != "object" {
        throw new Exception("A dependency injector container is required to obtain the services related to the ORM");
    }

    /**
     * Request the connection service from the DI
     */
    let connection = dependencyInjector->getShared(service);
    if typeof connection != "object" {
        throw new Exception("Invalid injected connection service");
    }

    return connection;
}


public function getConnectionService(<CollectionInterface> model) -> string
{
    var service, entityName;

    let service = "mongo";
    let entityName = get_class(model);
    if isset this->_connectionServices[entityName] {
        let service = this->_connectionServices[entityName];
    }

    return service;
}

Can you please use a settable variable for the connection service name instead of a hard coded string like "mongo" .

@sergeyklay
Copy link
Contributor

@AlexKomrakov Could you please deal with this?

@sergeyklay sergeyklay added the enhancement Enhancement to the framework label Apr 29, 2016
@sergeyklay
Copy link
Contributor

Fixed in 2.1.x branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to the framework
Projects
None yet
Development

No branches or pull requests

2 participants