1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mouf\Database\TDBM; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
Copyright (C) 2006-2009 David Négrier - THE CODING MACHINE |
7
|
|
|
|
8
|
|
|
This program is free software; you can redistribute it and/or modify |
9
|
|
|
it under the terms of the GNU General Public License as published by |
10
|
|
|
the Free Software Foundation; either version 2 of the License, or |
11
|
|
|
(at your option) any later version. |
12
|
|
|
|
13
|
|
|
This program is distributed in the hope that it will be useful, |
14
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
GNU General Public License for more details. |
17
|
|
|
|
18
|
|
|
You should have received a copy of the GNU General Public License |
19
|
|
|
along with this program; if not, write to the Free Software |
20
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Instances of this class represent an object that is bound to a row in a database table. |
25
|
|
|
* You access access the rows using there name, as a property of an object, or as a table. |
26
|
|
|
* For instance: |
27
|
|
|
* <code>$tdbmObject->myrow</code> |
28
|
|
|
* or |
29
|
|
|
* <code>$tdbmObject['myrow']</code> |
30
|
|
|
* are both valid. |
31
|
|
|
* |
32
|
|
|
* @author David Negrier |
33
|
|
|
*/ |
34
|
|
|
class TDBMObject extends AbstractTDBMObject |
35
|
|
|
{ |
36
|
|
|
public function getProperty($var, $tableName = null) |
37
|
|
|
{ |
38
|
|
|
return $this->get($var, $tableName); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function setProperty($var, $value, $tableName = null) |
42
|
|
|
{ |
43
|
|
|
$this->set($var, $value, $tableName); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Specify data which should be serialized to JSON. |
48
|
|
|
* |
49
|
|
|
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
50
|
|
|
* |
51
|
|
|
* @return mixed data which can be serialized by <b>json_encode</b>, |
52
|
|
|
* which is a value of any type other than a resource. |
53
|
|
|
* |
54
|
|
|
* @since 5.4.0 |
55
|
|
|
*/ |
56
|
|
|
public function jsonSerialize() |
57
|
|
|
{ |
58
|
|
|
throw new TDBMException('Json serialization is only implemented for generated beans.'); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|