Conditions | 3 |
Paths | 4 |
Total Lines | 46 |
Code Lines | 34 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
50 | public function prepare() |
||
51 | { |
||
52 | // Perform SQL table creation |
||
53 | foreach (scandir(__DIR__.'/../sql/') as $file) { |
||
54 | db()->query($this->readSQL($file)); |
||
55 | } |
||
56 | |||
57 | // Initiate migration mechanism |
||
58 | db()->migration(get_class($this), array($this, 'migrator')); |
||
59 | |||
60 | // Define permanent table relations |
||
61 | new TableRelation('material', 'user', 'UserID', 0, 'user_id'); |
||
62 | new TableRelation('material', 'gallery', 'MaterialID', TableRelation::T_ONE_TO_MANY); |
||
63 | new TableRelation('material', 'materialfield', 'MaterialID', TableRelation::T_ONE_TO_MANY); |
||
64 | new TableRelation('material', 'field', 'materialfield.FieldID', TableRelation::T_ONE_TO_MANY); |
||
65 | new TableRelation('material', 'structurematerial', 'MaterialID', TableRelation::T_ONE_TO_MANY); |
||
66 | new TableRelation('material', 'structure', 'structurematerial.StructureID', TableRelation::T_ONE_TO_MANY); |
||
67 | new TableRelation('materialfield', 'field', 'FieldID'); |
||
68 | new TableRelation('materialfield', 'material', 'MaterialID'); |
||
69 | new TableRelation('structurematerial', 'structure', 'StructureID'); |
||
70 | new TableRelation('structurematerial', 'materialfield', 'MaterialID', TableRelation::T_ONE_TO_MANY); |
||
71 | new TableRelation('structurematerial', 'material', 'MaterialID', TableRelation::T_ONE_TO_MANY); |
||
72 | new TableRelation('structure', 'material', 'structurematerial.MaterialID', TableRelation::T_ONE_TO_MANY, null, 'manymaterials'); |
||
1 ignored issue
–
show
|
|||
73 | new TableRelation('structure', 'gallery', 'structurematerial.MaterialID', TableRelation::T_ONE_TO_MANY, null, 'manymaterials'); |
||
1 ignored issue
–
show
|
|||
74 | /*new TableRelation( 'structure', 'material', 'MaterialID' );*/ |
||
75 | new TableRelation('structure', 'user', 'UserID', 0, 'user_id'); |
||
76 | new TableRelation('structure', 'materialfield', 'material.MaterialID', TableRelation::T_ONE_TO_MANY, 'MaterialID', '_mf'); |
||
1 ignored issue
–
show
|
|||
77 | new TableRelation('structure', 'structurematerial', 'StructureID', TableRelation::T_ONE_TO_MANY); |
||
78 | new TableRelation('related_materials', 'material', 'first_material', TableRelation::T_ONE_TO_MANY, 'MaterialID'); |
||
1 ignored issue
–
show
|
|||
79 | new TableRelation('related_materials', 'materialfield', 'first_material', TableRelation::T_ONE_TO_MANY, 'MaterialID'); |
||
1 ignored issue
–
show
|
|||
80 | new TableRelation('field', 'structurefield', 'FieldID'); |
||
81 | new TableRelation('field', 'structure', 'structurefield.StructureID'); |
||
82 | new TableRelation('structurefield', 'field', 'FieldID'); |
||
83 | new TableRelation('structurefield', 'materialfield', 'FieldID'); |
||
84 | new TableRelation('structurefield', 'material', 'materialfield.MaterialID'); |
||
85 | new TableRelation('structure', 'structure_relation', 'StructureID', TableRelation::T_ONE_TO_MANY, 'parent_id', 'children_relations'); |
||
1 ignored issue
–
show
|
|||
86 | new TableRelation('structure', 'structure', 'children_relations.child_id', TableRelation::T_ONE_TO_MANY, 'StructureID', 'children'); |
||
1 ignored issue
–
show
|
|||
87 | new TableRelation('structure', 'structure_relation', 'StructureID', TableRelation::T_ONE_TO_MANY, 'child_id', 'parents_relations'); |
||
1 ignored issue
–
show
|
|||
88 | new TableRelation('structure', 'structure', 'parents_relations.parent_id', TableRelation::T_ONE_TO_MANY, 'StructureID', 'parents'); |
||
1 ignored issue
–
show
|
|||
89 | new TableRelation('structurematerial', 'structure_relation', 'StructureID', TableRelation::T_ONE_TO_MANY, 'parent_id'); |
||
1 ignored issue
–
show
|
|||
90 | new TableRelation('groupright', 'right', 'RightID', TableRelation::T_ONE_TO_MANY); |
||
91 | //elapsed('CMS:prepare'); |
||
92 | |||
93 | // Все прошло успешно |
||
94 | return true && parent::prepare(); |
||
95 | } |
||
96 | |||
172 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: