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: namespace Xoops\Core\Kernel;
12:
13: use Xoops\Core\Database\Connection;
14:
15: /**
16: * XOOPS Kernel Object Handler
17: *
18: * This class is an abstract class of handler classes that are responsible for providing
19: * data access mechanisms to the data source of its corresponding data objects
20: *
21: * @category Xoops\Core\Kernel\XoopsObjectHandler
22: * @package Xoops\Core\Kernel
23: * @author Kazumi Ono <onokazu@xoops.org>
24: * @copyright 2000-2015 XOOPS Project (http://xoops.org)
25: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
26: * @link http://xoops.org
27: * @since 2.0.0
28: */
29: abstract class XoopsObjectHandler
30: {
31: /**
32: * @var Connection
33: */
34: public $db2;
35:
36: /**
37: * called from child classes only
38: *
39: * @param Connection $db database connection
40: */
41: protected function __construct(Connection $db = null)
42: {
43: if (!($db instanceof Connection)) {
44: $db = \Xoops::getInstance()->db();
45: }
46: $this->db2 = $db;
47: }
48:
49: /**
50: * creates a new object
51: *
52: * @return XoopsObject
53: */
54: public function create()
55: {
56: }
57:
58: /**
59: * gets a value object
60: *
61: * @param int $int_id id
62: *
63: * @return mixed
64: */
65: public function get($int_id)
66: {
67: }
68:
69: /**
70: * insert/update object
71: *
72: * @param XoopsObject $object object to insert
73: * @param bool $force use force
74: *
75: * @return mixed
76: */
77: public function insert(XoopsObject $object, $force = true)
78: {
79: }
80:
81: /**
82: * delete object from database
83: *
84: * @param XoopsObject $object object to delete
85: * @param bool $force use force
86: *
87: * @return boolean|null FALSE if failed.
88: */
89: public function delete(XoopsObject $object, $force = true)
90: {
91: }
92: }
93: