composer package updates
[openemr.git] / vendor / doctrine / couchdb / lib / Doctrine / CouchDB / Tools / Console / Helper / CouchDBHelper.php
blob221c76b23955a7d7ed4b13b628fe4262b2f606ce
1 <?php
2 /*
3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 * This software consists of voluntary contributions made by many individuals
16 * and is licensed under the MIT license. For more information, see
17 * <http://www.doctrine-project.org>.
20 namespace Doctrine\CouchDB\Tools\Console\Helper;
22 use Symfony\Component\Console\Helper\Helper;
23 use Doctrine\CouchDB\CouchDBClient;
24 use Doctrine\ODM\CouchDB\DocumentManager;
26 /**
27 * Doctrine CLI Connection Helper.
29 * @license http://www.opensource.org/licenses/mit-license.php MIT
30 * @link www.doctrine-project.org
31 * @since 2.0
32 * @author Benjamin Eberlei <kontakt@beberlei.de>
34 class CouchDBHelper extends Helper
36 protected $couchDBClient;
38 /**
39 * @var DocumentManager
41 protected $dm;
43 /**
44 * Constructor
46 * @param CouchDBClient $couchDBClient
47 * @param DocumentManager $dm
49 public function __construct(CouchDBClient $couchDBClient = null, DocumentManager $dm = null)
51 if (!$couchDBClient && $dm) {
52 $couchDBClient = $dm->getCouchDBClient();
55 $this->couchDBClient = $couchDBClient;
56 $this->dm = $dm;
59 /**
60 * Retrieves Doctrine ODM CouchDB Manager
62 * @return \Doctrine\ODM\CouchDB\DocumentManager
64 public function getDocumentManager()
66 return $this->dm;
69 /**
70 * @return CouchDBClient
72 public function getCouchDBClient()
74 return $this->couchDBClient;
77 /**
78 * @see Helper
80 public function getName()
82 return 'couchdb';