Skip to content

Commit 2687591

Browse files
committed
fix mongo and better readme
1 parent c536bf4 commit 2687591

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ You also must follow a convention when naming your service to make `cf-helper-ph
100100
- For mongodb connector
101101
- `mongodb`
102102

103+
### Get the logger
104+
105+
You have also access to a logger set for Cloud Foundry environment, access to it like this:
106+
107+
```php
108+
<?php
109+
$logger = CfHelper::getInstance()->getLogger();
110+
```
111+
103112
Set php configuration
104113
-------------------------
105114
With [pivotal-cf-experimental/cf-buildpack-php](https://github.com/pivotal-cf-experimental/cf-buildpack-php) you can set a `.user.ini` file to set your php configuration but it's not very flexible, you can also use directly `ini_set()` but you will have to do all by your own.

src/orange/cfhelper/CfHelper.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use orange\cfhelper\configuration\PhpIniConfigurator;
1818
use orange\cfhelper\connectors\AbstractConnector;
1919
use orange\cfhelper\connectors\DatabaseConnector;
20+
use orange\cfhelper\connectors\MongoDbConnector;
2021
use orange\cfhelper\connectors\RedisConnector;
2122
use orange\cfhelper\logger\CloudFoundryLogger;
2223
use orange\cfhelper\services\ServiceManager;
@@ -26,6 +27,8 @@
2627
/**
2728
* Class CfHelper
2829
* @package orange\cfhelper
30+
*
31+
* @method
2932
*/
3033
class CfHelper extends SphringRunner
3134
{
@@ -108,7 +111,11 @@ public function getRedisConnector()
108111
return $this->getSphring()->getBean('cfhelper.connector.redis');
109112
}
110113

111-
public function getMongoDbConnector(){
112-
return $this->getSphring()->getBean('cfhelper.connector.redis');
114+
/**
115+
* @return MongoDbConnector
116+
*/
117+
public function getMongoDbConnector()
118+
{
119+
return $this->getSphring()->getBean('cfhelper.connector.mongo');
113120
}
114121
}

0 commit comments

Comments
 (0)