1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Base
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Adapter Instance Class
14 *
15 * @since 11.1
16 */
17 class JAdapterInstance extends JObject
18 {
19 /**
20 * Parent
21 *
22 * @var JAdapter
23 * @since 11.1
24 */
25 protected $parent = null;
26
27 /**
28 * Database
29 *
30 * @var JDatabaseDriver
31 * @since 11.1
32 */
33 protected $db = null;
34
35 /**
36 * Constructor
37 *
38 * @param JAdapter $parent Parent object
39 * @param JDatabaseDriver $db Database object
40 * @param array $options Configuration Options
41 *
42 * @since 11.1
43 */
44 public function __construct(JAdapter $parent, JDatabaseDriver $db, array $options = array())
45 {
46 // Set the properties from the options array that is passed in
47 $this->setProperties($options);
48
49 // Set the parent and db in case $options for some reason overrides it.
50 $this->parent = $parent;
51
52 // Pull in the global dbo in case something happened to it.
53 $this->db = $db ?: JFactory::getDbo();
54 }
55
56 /**
57 * Retrieves the parent object
58 *
59 * @return JAdapter parent
60 *
61 * @since 11.1
62 */
63 public function getParent()
64 {
65 return $this->parent;
66 }
67 }
68