Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
a5799c4d
Commit
a5799c4d
authored
Apr 08, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DBAL-107'
parents
8ed71eb5
d3436539
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
24 deletions
+19
-24
Graphviz.php
lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php
+19
-24
No files found.
lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php
View file @
a5799c4d
...
@@ -41,8 +41,8 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
...
@@ -41,8 +41,8 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
public
function
acceptForeignKey
(
Table
$localTable
,
ForeignKeyConstraint
$fkConstraint
)
public
function
acceptForeignKey
(
Table
$localTable
,
ForeignKeyConstraint
$fkConstraint
)
{
{
$this
->
output
.=
$this
->
createNodeRelation
(
$this
->
output
.=
$this
->
createNodeRelation
(
$fkConstraint
->
getLocalTableName
(),
$fkConstraint
->
getLocalTableName
()
.
":col"
.
current
(
$fkConstraint
->
getLocalColumns
())
.
":se"
,
$fkConstraint
->
getForeignTableName
(),
$fkConstraint
->
getForeignTableName
()
.
":col"
.
current
(
$fkConstraint
->
getForeignColumns
())
.
":se"
,
array
(
array
(
'dir'
=>
'back'
,
'dir'
=>
'back'
,
'arrowtail'
=>
'dot'
,
'arrowtail'
=>
'dot'
,
...
@@ -61,6 +61,7 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
...
@@ -61,6 +61,7 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
$this
->
output
=
'digraph "'
.
sha1
(
mt_rand
()
)
.
'" {'
.
"
\n
"
;
$this
->
output
=
'digraph "'
.
sha1
(
mt_rand
()
)
.
'" {'
.
"
\n
"
;
$this
->
output
.=
'splines = true;'
.
"
\n
"
;
$this
->
output
.=
'splines = true;'
.
"
\n
"
;
$this
->
output
.=
'overlap = false;'
.
"
\n
"
;
$this
->
output
.=
'overlap = false;'
.
"
\n
"
;
$this
->
output
.=
'outputorder=edgesfirst;'
.
"
\n
"
;
$this
->
output
.=
'mindist = 0.6;'
.
"
\n
"
;
$this
->
output
.=
'mindist = 0.6;'
.
"
\n
"
;
$this
->
output
.=
'sep = .2;'
.
"
\n
"
;
$this
->
output
.=
'sep = .2;'
.
"
\n
"
;
}
}
...
@@ -72,43 +73,37 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
...
@@ -72,43 +73,37 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
public
function
acceptTable
(
Table
$table
)
public
function
acceptTable
(
Table
$table
)
{
{
$name
=
$table
->
getName
();
$columns
=
array
();
foreach
(
$table
->
getColumns
()
AS
$column
)
{
$name
=
$column
->
getName
();
if
(
in_array
(
$name
,
$table
->
getPrimaryKey
()
->
getColumns
()))
{
$name
=
$name
.
"
\xe2\x9c\xb6
"
;
}
$columns
[]
=
$name
;
}
$this
->
output
.=
$this
->
createNode
(
$this
->
output
.=
$this
->
createNode
(
$table
->
getName
(),
$table
->
getName
(),
array
(
array
(
'label'
=>
$this
->
createTableLabel
(
$table
->
getName
(),
$columns
),
'label'
=>
$this
->
createTableLabel
(
$table
),
'shape'
=>
'plaintext'
,
'shape'
=>
'plaintext'
,
)
)
);
);
}
}
private
function
createTableLabel
(
$name
,
$columns
)
private
function
createTableLabel
(
Table
$table
)
{
{
// Start the table
// Start the table
$label
=
'<<TABLE CELLSPACING="0" BORDER="
0
" ALIGN="LEFT">'
;
$label
=
'<<TABLE CELLSPACING="0" BORDER="
1
" ALIGN="LEFT">'
;
// The title
// The title
$label
.=
'<TR><TD BORDER="1"
ALIGN="CENTER" BGCOLOR="#fcaf3e"><FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="12">'
.
$name
.
'</FONT></TD></TR>'
;
$label
.=
'<TR><TD BORDER="1"
COLSPAN="3" ALIGN="CENTER" BGCOLOR="#fcaf3e"><FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="12">'
.
$table
->
getName
()
.
'</FONT></TD></TR>'
;
// The attributes block
// The attributes block
$label
.=
'<TR><TD BORDER="1" ALIGN="LEFT" BGCOLOR="#eeeeec">'
;
foreach
(
$table
->
getColumns
()
as
$column
)
{
if
(
count
(
$columns
)
===
0
)
{
$columnLabel
=
$column
->
getName
();
$label
.=
' '
;
}
$label
.=
'<TR>'
;
foreach
(
$columns
as
$attribute
)
{
$label
.=
'<TD BORDER="0" ALIGN="LEFT" BGCOLOR="#eeeeec">'
;
$label
.=
'<FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="10">'
.
$attribute
.
'</FONT><BR ALIGN="LEFT"/>'
;
$label
.=
'<FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="12">'
.
$columnLabel
.
'</FONT>'
;
$label
.=
'</TD><TD BORDER="0" ALIGN="LEFT" BGCOLOR="#eeeeec"><FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="10">'
.
strtolower
(
$column
->
getType
())
.
'</FONT></TD>'
;
$label
.=
'<TD BORDER="0" ALIGN="RIGHT" BGCOLOR="#eeeeec" PORT="col'
.
$column
->
getName
()
.
'">'
;
if
(
in_array
(
$column
->
getName
(),
$table
->
getPrimaryKey
()
->
getColumns
()))
{
$label
.=
"
\xe2\x9c\xb7
"
;
}
$label
.=
'</TD></TR>'
;
}
}
$label
.=
'</TD></TR>'
;
// End the table
// End the table
$label
.=
'</TABLE>>'
;
$label
.=
'</TABLE>>'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment