1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* You may not change or alter any portion of this comment or credits |
4
|
|
|
* of supporting developers from this source code or any supporting source code |
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
* This program is distributed in the hope that it will be useful, |
7
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
8
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
use Xoops\Core\Database\Connection; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* This class is for compatibility with pre 2.6.0 code |
15
|
|
|
*/ |
16
|
|
|
abstract class XoopsObject extends Xoops\Core\Kernel\XoopsObject |
17
|
|
|
{ |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* This class is for compatibility with pre 2.6.0 code |
22
|
|
|
*/ |
23
|
|
|
abstract class XoopsObjectHandler extends Xoops\Core\Kernel\XoopsObjectHandler |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* This is a reference to the legacy database connection |
27
|
|
|
*/ |
28
|
|
|
public $db; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* this is a legacy compatibility shim to make the legacy database available |
32
|
|
|
* |
33
|
|
|
* @param Connection $db reference to the {@link Connection} object |
34
|
|
|
*/ |
35
|
1 |
|
public function __construct(Connection $db) |
36
|
|
|
{ |
37
|
1 |
|
$this->db = XoopsDatabaseFactory::getDatabaseConnection(); // get legacy connection |
38
|
1 |
|
parent::__construct($db); |
39
|
1 |
|
} |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* This class is for compatibility with pre 2.6.0 code |
44
|
|
|
*/ |
45
|
|
|
abstract class XoopsPersistableObjectHandler extends Xoops\Core\Kernel\XoopsPersistableObjectHandler |
46
|
|
|
{ |
47
|
|
|
/** |
48
|
|
|
* This is a reference to the legacy database connection |
49
|
|
|
*/ |
50
|
|
|
public $db; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* this is a legacy compatibility shim to make the legacy database available |
54
|
|
|
* |
55
|
|
|
* @param Connection $db reference to the {@link Connection} object |
56
|
|
|
*/ |
57
|
1 |
|
protected function __construct( |
58
|
|
|
Connection $db = null, |
59
|
|
|
$table = '', |
60
|
|
|
$className = '', |
61
|
|
|
$keyName = '', |
62
|
|
|
$identifierName = '' |
63
|
|
|
) { |
64
|
1 |
|
if ($db===null) { |
65
|
|
|
$this->db2 = \Xoops\Core\Database\Factory::getConnection(); |
66
|
|
|
$db = $this->db2; |
67
|
|
|
} |
68
|
1 |
|
$this->db = XoopsDatabaseFactory::getDatabaseConnection(); // get legacy connection |
69
|
1 |
|
parent::__construct($db, $table, $className, $keyName, $identifierName); |
70
|
1 |
|
} |
71
|
|
|
} |
72
|
|
|
|