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
a476c62e
Commit
a476c62e
authored
Nov 07, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up some stuff with schema generation and removed name: key from column definition.
parent
3b898ca9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
20 deletions
+19
-20
Schema.php
lib/Doctrine/Export/Schema.php
+6
-7
Schema.php
lib/Doctrine/Import/Schema.php
+13
-13
No files found.
lib/Doctrine/Export/Schema.php
View file @
a476c62e
...
@@ -59,22 +59,21 @@ class Doctrine_Export_Schema
...
@@ -59,22 +59,21 @@ class Doctrine_Export_Schema
// we iterate trhough the diff of previously declared classes
// we iterate trhough the diff of previously declared classes
// and currently declared classes
// and currently declared classes
foreach
(
$loadedModels
as
$
n
ame
)
{
foreach
(
$loadedModels
as
$
classN
ame
)
{
if
(
!
empty
(
$models
)
&&
!
in_array
(
$
n
ame
,
$models
))
{
if
(
!
empty
(
$models
)
&&
!
in_array
(
$
classN
ame
,
$models
))
{
continue
;
continue
;
}
}
$record
=
new
$
n
ame
();
$record
=
new
$
classN
ame
();
$recordTable
=
$record
->
getTable
();
$recordTable
=
$record
->
getTable
();
$data
=
$recordTable
->
getExportableFormat
();
$data
=
$recordTable
->
getExportableFormat
();
$table
=
array
();
$table
=
array
();
$table
[
'tableName'
]
=
$data
[
'tableName'
];
$table
[
'className'
]
=
get_class
(
$record
);
foreach
(
$data
[
'columns'
]
AS
$name
=>
$column
)
{
foreach
(
$data
[
'columns'
]
AS
$name
=>
$column
)
{
$data
[
'columns'
][
$name
][
'name'
]
=
$name
;
$data
[
'columns'
][
$name
][
'type'
]
=
$column
[
'type'
]
.
'('
.
$column
[
'length'
]
.
')'
;
unset
(
$data
[
'columns'
][
$name
][
'length'
]);
}
}
$table
[
'columns'
]
=
$data
[
'columns'
];
$table
[
'columns'
]
=
$data
[
'columns'
];
...
@@ -105,7 +104,7 @@ class Doctrine_Export_Schema
...
@@ -105,7 +104,7 @@ class Doctrine_Export_Schema
}
}
}
}
$array
[
$
table
[
'className'
]
]
=
$table
;
$array
[
$
className
]
=
$table
;
}
}
return
$array
;
return
$array
;
...
...
lib/Doctrine/Import/Schema.php
View file @
a476c62e
...
@@ -100,14 +100,14 @@ class Doctrine_Import_Schema
...
@@ -100,14 +100,14 @@ class Doctrine_Import_Schema
public
function
buildSchema
(
$schema
,
$format
)
public
function
buildSchema
(
$schema
,
$format
)
{
{
$array
=
array
();
$array
=
array
();
foreach
((
array
)
$schema
AS
$s
)
{
foreach
((
array
)
$schema
AS
$s
)
{
if
(
is_file
(
$s
))
{
if
(
is_file
(
$s
))
{
$array
=
array_merge
(
$array
,
$this
->
parseSchema
(
$s
,
$format
));
$array
=
array_merge
(
$array
,
$this
->
parseSchema
(
$s
,
$format
));
}
else
if
(
is_dir
(
$s
))
{
}
else
if
(
is_dir
(
$s
))
{
$it
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$s
),
$it
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$s
),
RecursiveIteratorIterator
::
LEAVES_ONLY
);
RecursiveIteratorIterator
::
LEAVES_ONLY
);
foreach
(
$it
as
$file
)
{
foreach
(
$it
as
$file
)
{
$e
=
explode
(
'.'
,
$file
->
getFileName
());
$e
=
explode
(
'.'
,
$file
->
getFileName
());
if
(
end
(
$e
)
===
$format
)
{
if
(
end
(
$e
)
===
$format
)
{
...
@@ -116,9 +116,9 @@ class Doctrine_Import_Schema
...
@@ -116,9 +116,9 @@ class Doctrine_Import_Schema
}
}
}
}
}
}
$this
->
buildRelationships
(
$array
);
$this
->
buildRelationships
(
$array
);
return
array
(
'schema'
=>
$array
,
'relations'
=>
$this
->
_relations
);
return
array
(
'schema'
=>
$array
,
'relations'
=>
$this
->
_relations
);
}
}
...
@@ -218,15 +218,15 @@ class Doctrine_Import_Schema
...
@@ -218,15 +218,15 @@ class Doctrine_Import_Schema
$exist_relations
=
array
();
$exist_relations
=
array
();
$unique_relations
=
array
();
$unique_relations
=
array
();
foreach
(
$all_relations
as
$relation
)
{
foreach
(
$all_relations
as
$relation
)
{
if
(
!
in_array
(
$relation
[
'class'
],
$exist_relations
))
{
if
(
!
in_array
(
$relation
[
'class'
],
$exist_relations
))
{
$exist_relations
[]
=
$relation
[
'class'
];
$exist_relations
[]
=
$relation
[
'class'
];
$unique_relations
=
array_merge
(
$unique_relations
,
array
(
$relation
[
'alias'
]
=>
$relation
));
$unique_relations
=
array_merge
(
$unique_relations
,
array
(
$relation
[
'alias'
]
=>
$relation
));
}
else
{
}
else
{
// check to see if this relationship is not autogenerated, if it's not, then the user must have explicitly declared it
// check to see if this relationship is not autogenerated, if it's not, then the user must have explicitly declared it
if
(
!
isset
(
$relation
[
'autogenerated'
])
||
$relation
[
'autogenerated'
]
!=
true
)
{
if
(
!
isset
(
$relation
[
'autogenerated'
])
||
$relation
[
'autogenerated'
]
!=
true
)
{
$unique_relations
=
array_merge
(
$unique_relations
,
array
(
$relation
[
'alias'
]
=>
$relation
));
$unique_relations
=
array_merge
(
$unique_relations
,
array
(
$relation
[
'alias'
]
=>
$relation
));
}
}
}
}
}
}
return
$unique_relations
;
return
$unique_relations
;
...
@@ -320,7 +320,7 @@ class Doctrine_Import_Schema
...
@@ -320,7 +320,7 @@ class Doctrine_Import_Schema
if
(
!
empty
(
$columns
))
{
if
(
!
empty
(
$columns
))
{
foreach
(
$columns
as
$columnName
=>
$field
)
{
foreach
(
$columns
as
$columnName
=>
$field
)
{
$colDesc
=
array
();
$colDesc
=
array
();
$colDesc
[
'name'
]
=
isset
(
$field
[
'name'
])
?
(
string
)
$field
[
'name'
]
:
$columnName
;
$colDesc
[
'name'
]
=
$columnName
;
$e
=
explode
(
'('
,
$field
[
'type'
]);
$e
=
explode
(
'('
,
$field
[
'type'
]);
if
(
isset
(
$e
[
0
])
&&
isset
(
$e
[
1
]))
{
if
(
isset
(
$e
[
0
])
&&
isset
(
$e
[
1
]))
{
...
...
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