13 $this->originalString=$yumlString;
18 return $prefix.\ucfirst($table);
22 $this->parts=\preg_split(
'@\ *?,\ *?@', $str);
23 foreach ($this->parts as $part){
31 \preg_match_all(
'@\[\w+[\|\]]@', $part,$matches);
32 if(\
sizeof($matches[0])>0){
33 foreach ($matches[0] as $match){
34 $table=\substr($match,1, \strlen($match)-2);
35 $this->tables[$table]=[];
41 $tables=\array_keys($this->tables);
44 \preg_match(
'@\['.$table.
'\|(.*?)\]@', $this->originalString,$matchProperties);
45 if(isset($matchProperties[1])){
46 $properties=$matchProperties[1];
59 $properties=\explode(
";", $propertiesString);
60 foreach ($properties as $property){
62 if(!isset($this->tables[$table][
"properties"]))
63 $this->tables[$table][
"properties"]=[];
64 $this->tables[$table][
"properties"][]=$result;
71 \preg_match_all(
'@«(.+?)»@', $property,$matches);
72 foreach ($matches as $match){
74 $property=\str_replace($match[0],
"", $property);
76 case $this->stereotypes[
"pk"]:
79 case $this->stereotypes[
"null"]:
84 $parts=\explode(
":", $property);
85 \preg_match(
'@\ *?(\w+)@',
$parts[0],$match);
87 $result[
"name"]=$match[1];
98 foreach ($this->tables[$table][
"properties"] as $property){
100 $result=$property[
"name"];
101 if(isset($property[
"pk"]) && $property[
"pk"])
102 return $property[
"name"];
108 foreach ($this->tables[$table][
"properties"] as $property){
109 if($property[
"name"]===$fieldName)
110 return $property[
"type"];
117 foreach ($this->tables[$table][
"properties"] as $property){
118 if(isset($property[
"pk"]) && $property[
"pk"])
119 $result[]=$property[
"name"];
126 \preg_match_all(
'@\['.$table.
'\][^,]*?1-.*?\[(\w+)\]@', $this->originalString,$matches);
128 \preg_match_all(
'@\[(\w+)\].*?-[^,]*?1\['.$table.
'\]@', $this->originalString,$matches);
133 if(\
sizeof($matches)>1){
136 foreach ($matches[1] as $match){
139 $this->tables[$table][
"relations"][]=[
"TABLE_NAME"=>$tableName,
"COLUMN_NAME"=>$fk];
147 \preg_match_all(
'@\['.$table.
'\][^,]*?\*-.*?\*\[(\w+)\]@', $this->originalString,$matches);
155 if(\
sizeof($matches)>1){
156 foreach ($matches[1] as $match){
162 $newTable=$table.
"_".$tableName;
163 $this->tables[$newTable]=[];
164 $this->tables[$newTable][
"properties"][]=[
"name"=>$myFk,
"type"=>$myFkType,
"pk"=>
true];
165 $this->tables[$newTable][
"properties"][]=[
"name"=>$fk,
"type"=>$fkType,
"pk"=>
true];
166 $this->tables[$tableName][
"relations"][]=[
"TABLE_NAME"=>$newTable,
"COLUMN_NAME"=>$fk];
167 $this->tables[$table][
"relations"][]=[
"TABLE_NAME"=>$newTable,
"COLUMN_NAME"=>$myFk];
181 return \array_keys($this->tables);
185 return $this->tables[$table][
"properties"];
189 if(isset($this->tables[$table][
"relations"]))
190 return $this->tables[$table][
"relations"];
_parseRelations($table, $matches)
parseProperties($propertiesString, $table)
_parseManyRelations($table, $matches)
getFkName($table, $prefix="id")
parseManyRelations($table)
getFieldType($table, $fieldName)