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

How to connect to mongodb? #175

Open
phpsharma opened this issue Nov 15, 2013 · 2 comments
Open

How to connect to mongodb? #175

phpsharma opened this issue Nov 15, 2013 · 2 comments

Comments

@phpsharma
Copy link

Hi
This is a great Plugin ..
I am not able to connect to mongodb using API. Please help?

Thanks in advance,
sharma

@phpsharma
Copy link
Author

Hi ,

I am using mysql by using pimple()

$app->container = new Pimple();

$app->container['database'] = function() {
$host = 'localhost';
$dbName = 'codesnippets';
$user = 'root';
$pass = '';

return new \PDO("mysql:host={$host};dbname={$dbName}", $user, $pass);

};

//print_r($app->container['database']) ;

How to use below code as per the above?
$app->container['dataStore'] = function ($c) {
return new DataStore($c['database']);
};

I am not able to get $this->container['database''] in the corresponding controllerClass.php

Please help me how to use this datastore..

Thanks,
sharma

@phpsharma
Copy link
Author

I solved it using Redbeans ORM...
No need of pimple or class injection..

Simple changes to dispatch file and your service class..
Please let me know any one needs help..

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

No branches or pull requests

1 participant