|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
4
|
|
|
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
5
|
|
|
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
use midgard\portable\storage\connection; |
|
9
|
|
|
|
|
10
|
|
|
class midgard_reflector_object |
|
11
|
|
|
{ |
|
12
|
1 |
|
public static function get_property_primary($classname) |
|
|
|
|
|
|
13
|
|
|
{ |
|
14
|
1 |
|
return 'id'; |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
1 |
|
public static function get_property_up($classname) |
|
18
|
|
|
{ |
|
19
|
1 |
|
return midgard_object_class::get_property_up($classname); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
1 |
|
public static function get_property_parent($classname) |
|
23
|
|
|
{ |
|
24
|
1 |
|
return midgard_object_class::get_property_parent($classname); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
1 |
|
public static function get_property_unique($classname) |
|
28
|
|
|
{ |
|
29
|
1 |
|
$cm = connection::get_em()->getClassMetadata($classname); |
|
30
|
1 |
|
if (empty($cm->midgard['unique_fields'])) { |
|
31
|
1 |
|
return null; |
|
32
|
|
|
} |
|
33
|
1 |
|
return $cm->midgard['unique_fields'][0]; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
1 |
|
public static function list_children($classname) |
|
37
|
|
|
{ |
|
38
|
1 |
|
$cm = connection::get_em()->getClassMetadata($classname); |
|
39
|
1 |
|
if (empty($cm->midgard['childtypes'])) { |
|
40
|
1 |
|
return []; |
|
41
|
|
|
} |
|
42
|
|
|
// @todo We filter out useful information (parent field name) in the name of mgd2 compat. |
|
43
|
1 |
|
return array_fill_keys(array_keys($cm->midgard['childtypes']), ''); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
2 |
|
public static function has_metadata_class($classname) |
|
47
|
|
|
{ |
|
48
|
2 |
|
return midgard_object_class::has_metadata($classname); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
1 |
|
public static function get_metadata_class($classname) |
|
52
|
|
|
{ |
|
53
|
1 |
|
if (!self::has_metadata_class($classname)) { |
|
54
|
1 |
|
return null; |
|
55
|
|
|
} |
|
56
|
1 |
|
return 'midgard_metadata'; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public static function get_schema_value($classname, $node_name) |
|
|
|
|
|
|
60
|
|
|
{ |
|
61
|
|
|
throw new Exception('Not implemented yet'); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public static function is_mixin($classname) |
|
|
|
|
|
|
65
|
|
|
{ |
|
66
|
|
|
return false; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public static function is_interface($classname) |
|
|
|
|
|
|
70
|
|
|
{ |
|
71
|
|
|
return false; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public static function is_abstract($classname) |
|
|
|
|
|
|
75
|
|
|
{ |
|
76
|
|
|
return false; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public static function list_defined_properties($classname) |
|
|
|
|
|
|
80
|
|
|
{ |
|
81
|
|
|
throw new Exception('Not implemented yet'); |
|
82
|
|
|
} |
|
83
|
|
|
} |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.