Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
ClassToYumlRelationsTrait.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\utils\yuml\traits
;
4
5
use
Ubiquity\orm\OrmUtils
;
6
use
Ubiquity\utils\yuml\ClassToYuml
;
7
use
Ubiquity\utils\yuml\Yuml
;
8
17
class
ClassToYumlRelationsTrait
{
18
protected
$oneToManys
= [ ];
19
protected
$manyToOne
= [ ];
20
protected
$manyToManys
= [ ];
21
protected
$extManyToManys
= [ ];
22
23
protected
function
loadOneToManys
() {
24
$oneToManys
= OrmUtils::getAnnotationInfo ( $this->
class
,
"#oneToMany"
);
25
if
(
$oneToManys
) {
26
foreach
(
$oneToManys
as $member => $array ) {
27
$this->oneToManys [$member] = $array [
"className"
];
28
}
29
}
30
}
31
32
public
function
loadManyToManys
() {
33
$manyToManys
= OrmUtils::getAnnotationInfo ( $this->
class
,
"#manyToMany"
);
34
if
(
$manyToManys
) {
35
foreach
(
$manyToManys
as $member => $array ) {
36
if
(isset ( $array [
"targetEntity"
] )) {
37
$this->manyToManys [$member] = $array [
"targetEntity"
];
38
$this->extManyToManys [$array [
"targetEntity"
]] = $this->class;
39
}
40
}
41
}
42
}
43
44
protected
function
loadManyToOne
() {
45
$manyToOne
= OrmUtils::getAnnotationInfo ( $this->
class
,
"#manyToOne"
);
46
if
(
$manyToOne
) {
47
foreach
(
$manyToOne
as $member ) {
48
$joinColumn = OrmUtils::getAnnotationInfoMember ( $this->
class
,
"#joinColumn"
, $member );
49
if
($joinColumn && isset ( $joinColumn [
"className"
] )) {
50
$this->manyToOne [$member] = $joinColumn [
"className"
];
51
}
52
}
53
}
54
}
55
56
protected
function
getShortClassName
($class) {
57
$reflect = new \ReflectionClass ( $class );
58
return
$reflect->getShortName ();
59
}
60
61
protected
function
_getYumlRelationsType
($relations, $branche) {
62
$myClass = $this->
getShortClassName
( $this->
class
);
63
$yumlRelations = [ ];
64
foreach
( $relations as $model ) {
65
$yumlRelations [] =
Yuml::setClassContent
( $myClass ) . $branche .
new
ClassToYuml
( $model, $this->displayAssociationClassProperties,
false
);
66
}
67
return
$yumlRelations;
68
}
69
70
protected
function
_getYumlManyToOne
() {
71
return
$this->
_getYumlRelationsType
( $this->manyToOne,
"0..*-1"
);
72
}
73
74
protected
function
_getYumlOneToMany
() {
75
return
$this->
_getYumlRelationsType
( $this->oneToManys,
"1-0..*"
);
76
}
77
78
protected
function
_getYumlManyToMany
() {
79
return
$this->
_getYumlRelationsType
( $this->manyToManys,
"0..*-0..*"
);
80
}
81
86
public
function
getExtManyToManys
() {
87
return
$this->extManyToManys
;
88
}
89
90
public
function
removeManyToManyExt
($targetClass) {
91
$member = array_search ( $targetClass, $this->manyToManys );
92
if
($member !==
false
) {
93
unset ( $this->manyToManys [$member] );
94
}
95
}
96
}
97
Ubiquity\orm\OrmUtils
Object/relational mapping utilities.
Definition
OrmUtils.php:17
Ubiquity\utils\yuml\ClassToYuml
yuml export tool for class Ubiquity\utils\yuml$ClassToYuml This class is part of Ubiquity
Definition
ClassToYuml.php:17
Ubiquity\utils\yuml\Yuml
Definition
Yuml.php:5
Ubiquity\utils\yuml\Yuml\setClassContent
static setClassContent($content)
Definition
Yuml.php:54
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait
Ubiquity\utils\yuml\traits$ClassToYumlRelationsTrait This class is part of Ubiquity.
Definition
ClassToYumlRelationsTrait.php:17
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\loadManyToManys
loadManyToManys()
Definition
ClassToYumlRelationsTrait.php:32
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\loadManyToOne
loadManyToOne()
Definition
ClassToYumlRelationsTrait.php:44
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\$manyToOne
$manyToOne
Definition
ClassToYumlRelationsTrait.php:19
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\_getYumlManyToOne
_getYumlManyToOne()
Definition
ClassToYumlRelationsTrait.php:70
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\loadOneToManys
loadOneToManys()
Definition
ClassToYumlRelationsTrait.php:23
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\getExtManyToManys
getExtManyToManys()
Definition
ClassToYumlRelationsTrait.php:86
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\$oneToManys
$oneToManys
Definition
ClassToYumlRelationsTrait.php:18
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\$extManyToManys
$extManyToManys
Definition
ClassToYumlRelationsTrait.php:21
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\_getYumlRelationsType
_getYumlRelationsType($relations, $branche)
Definition
ClassToYumlRelationsTrait.php:61
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\getShortClassName
getShortClassName($class)
Definition
ClassToYumlRelationsTrait.php:56
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\_getYumlManyToMany
_getYumlManyToMany()
Definition
ClassToYumlRelationsTrait.php:78
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\$manyToManys
$manyToManys
Definition
ClassToYumlRelationsTrait.php:20
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\_getYumlOneToMany
_getYumlOneToMany()
Definition
ClassToYumlRelationsTrait.php:74
Ubiquity\utils\yuml\traits\ClassToYumlRelationsTrait\removeManyToManyExt
removeManyToManyExt($targetClass)
Definition
ClassToYumlRelationsTrait.php:90
Ubiquity\utils\yuml\traits
Definition
ClassToYumlRelationsTrait.php:3
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
utils
yuml
traits
ClassToYumlRelationsTrait.php
Generated on Sun Dec 10 2023 15:04:28 for
Ubiquity
by
doxygen
1.9.8