1
|
|
|
<?php |
2
|
|
|
namespace samsoncms\api\generator; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Created by Vitaly Iegorov <[email protected]>. |
6
|
|
|
* on 11.02.16 at 18:07 |
7
|
|
|
*/ |
8
|
|
|
class Metadata |
9
|
|
|
{ |
10
|
|
|
/** Default type of metadata */ |
11
|
|
|
const TYPE_DEFAULT = 0; |
12
|
|
|
|
13
|
|
|
/** Nested materials type of metadata */ |
14
|
|
|
const TYPE_NESTED_MATERIAL = 1; |
15
|
|
|
|
16
|
|
|
/** Table type of metadata */ |
17
|
|
|
const TYPE_TABLE = 2; |
18
|
|
|
|
19
|
|
|
/** @var array List of types */ |
20
|
|
|
public static $types = array( |
21
|
|
|
self::TYPE_DEFAULT, |
22
|
|
|
self::TYPE_NESTED_MATERIAL, |
23
|
|
|
self::TYPE_TABLE, |
24
|
|
|
); |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Metadata constructor. |
28
|
|
|
* @param int $type |
29
|
|
|
*/ |
30
|
|
|
public function __construct($type = self::TYPE_DEFAULT) |
31
|
|
|
{ |
32
|
|
|
$this->type = $type; |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** @var string Type of entity */ |
36
|
|
|
public $type; |
37
|
|
|
/** @var string Transliterated and CapsCase entity name */ |
38
|
|
|
public $entity; |
39
|
|
|
/** @var string Real database entity identifier */ |
40
|
|
|
public $entityID; |
41
|
|
|
/** @var string Real database entity name */ |
42
|
|
|
public $entityRealName; |
43
|
|
|
/** @var int Parent entity identifier */ |
44
|
|
|
public $parentID; |
45
|
|
|
/** @var $this Metadata parent entity name */ |
46
|
|
|
public $parent; |
47
|
|
|
/** @var string Generated entity fully qualified class name */ |
48
|
|
|
public $className; |
49
|
|
|
|
50
|
|
|
// To be commented |
51
|
|
|
public $realNames = array(); |
52
|
|
|
public $allFieldIDs = array(); |
53
|
|
|
public $allFieldNames = array(); |
54
|
|
|
public $allFieldValueColumns = array(); |
55
|
|
|
public $localizedFieldIDs = array(); |
56
|
|
|
public $notLocalizedFieldIDs = array(); |
57
|
|
|
public $allFieldTypes = array(); |
58
|
|
|
public $fieldDescriptions= array(); |
59
|
|
|
|
60
|
|
|
// Old AR fields |
61
|
|
|
public $arSelect = array(); |
62
|
|
|
public $arMap = array(); |
63
|
|
|
public $arAttributes = array(); |
64
|
|
|
public $arFrom = array(); |
65
|
|
|
public $arGroup = array(); |
66
|
|
|
public $arRelationAlias = array(); |
67
|
|
|
public $arRelationType = array(); |
68
|
|
|
public $arRelations = array(); |
69
|
|
|
} |
70
|
|
|
|
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.