Skip to content

Commit 12d0d81

Browse files
committed
adding support for CouchbaseCache
1 parent 97ac8f7 commit 12d0d81

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

library/Bisna/Doctrine/Container.php

+6-17
Original file line numberDiff line numberDiff line change
@@ -614,26 +614,15 @@ private function startCacheInstance(array $config = array())
614614
} else if ($adapter instanceof \Doctrine\Common\Cache\CouchbaseCache) {
615615

616616
// Couchbase configuration
617-
$couchbaseConfig = array(
618-
'hosts' => array('localhost:8091'),
619-
'user' => isset($config['options']['user']) ? $config['options']['user'] : '',
620-
'password' => isset($config['options']['password']) ? $config['options']['password'] : '',
621-
'bucket' => isset($config['options']['bucket']) ? $config['options']['bucket'] : 'default',
622-
'persistent' => isset($config['options']['persistent']) ? $config['options']['persistent'] : true,
623-
);
624-
625-
if (isset($config['options']['servers'])) {
626-
627-
unset($couchbaseConfig['hosts']);
628-
629-
foreach ($config['options']['servers'] as $server) {
630-
$couchbaseConfig['hosts'][] = $server;
631-
}
632-
}
617+
$hosts = isset($config['options']['hosts']) ? $config['options']['hosts'] : array('localhost');
618+
$user = isset($config['options']['user']) ? $config['options']['user'] : '';
619+
$password = isset($config['options']['password']) ? $config['options']['password'] : '';
620+
$bucket = isset($config['options']['bucket']) ? $config['options']['bucket'] : 'default';
621+
$persistent = isset($config['options']['persistent']) ? $config['options']['persistent'] : true;
633622

634623
// Prevent stupid PHP error of missing extension (if other driver is being used)
635624
$couchbaseClassName = 'Couchbase';
636-
$couchbase = new $couchbaseClassName($couchbaseConfig);
625+
$couchbase = new $couchbaseClassName($hosts, $user, $password, $bucket, $persistent);
637626

638627
$adapter->setCouchbase($couchbase);
639628
} else if ($adapter instanceof \Doctrine\Common\Cache\MemcacheCache) {

0 commit comments

Comments
 (0)