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
121d9ad9
Commit
121d9ad9
authored
Aug 03, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fixes to get the importing a little closer.
parent
ff832983
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
+23
-16
Schema.php
lib/Doctrine/Import/Schema.php
+4
-1
Xml.php
lib/Doctrine/Import/Schema/Xml.php
+19
-15
No files found.
lib/Doctrine/Import/Schema.php
View file @
121d9ad9
...
@@ -56,7 +56,10 @@ class Doctrine_Import_Schema
...
@@ -56,7 +56,10 @@ class Doctrine_Import_Schema
$arr
=
$this
->
importSchema
(
$schema
);
$arr
=
$this
->
importSchema
(
$schema
);
foreach
(
$arr
as
$name
=>
$columns
)
{
foreach
(
$arr
as
$name
=>
$columns
)
{
$Builder
->
buildRecord
(
$name
,
$columns
);
$options
[
'className'
]
=
$name
;
$options
[
'fileName'
]
=
$directory
.
DIRECTORY_SEPARATOR
.
$name
.
'.class.php'
;
$builder
->
buildRecord
(
$options
,
$columns
,
array
());
}
}
}
}
}
}
\ No newline at end of file
lib/Doctrine/Import/Schema/Xml.php
View file @
121d9ad9
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
* @author Nicolas Bérard-Nault <nicobn@gmail.com>
* @author Nicolas Bérard-Nault <nicobn@gmail.com>
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
*/
class
Doctrine_Import_Schema_
Y
ml
extends
Doctrine_Import_Schema
class
Doctrine_Import_Schema_
X
ml
extends
Doctrine_Import_Schema
{
{
/**
/**
* importArr
* importArr
...
@@ -54,26 +54,30 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
...
@@ -54,26 +54,30 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
throw
new
Doctrine_Import_Exception
(
'Could not read schema file '
.
$schema
);
throw
new
Doctrine_Import_Exception
(
'Could not read schema file '
.
$schema
);
}
}
$xmlObj
=
simplexml_load_file
(
$schema
);
if
(
!
(
$xmlString
=
file_get_contents
(
$schema
)))
{
throw
new
Doctrine_Import_Exception
(
'Schema file '
.
$schema
.
' is empty'
);
}
$xmlObj
=
simplexml_load_string
(
$xmlString
);
// Go through all tables...
// Go through all tables...
foreach
(
$xmlObj
->
table
as
$table
)
{
foreach
(
$xmlObj
->
table
as
$table
)
{
// Go through all columns...
// Go through all columns...
foreach
(
$table
->
declaration
->
field
as
$field
)
{
foreach
(
$table
->
declaration
->
column
as
$column
)
{
$colDesc
=
array
(
$colDesc
=
array
(
'name'
=>
(
string
)
$
field
->
name
,
'name'
=>
(
string
)
$
column
->
name
,
'type'
=>
(
string
)
$
field
->
type
,
'type'
=>
(
string
)
$
column
->
type
,
'ptype'
=>
(
string
)
$
field
->
type
,
'ptype'
=>
(
string
)
$
column
->
type
,
'length'
=>
(
int
)
$
field
->
length
,
'length'
=>
(
int
)
$
column
->
length
,
'fixed'
=>
(
int
)
$
field
->
fixed
,
'fixed'
=>
(
int
)
$
column
->
fixed
,
'unsigned'
=>
(
bool
)
$
field
->
unsigned
,
'unsigned'
=>
(
bool
)
$
column
->
unsigned
,
'primary'
=>
(
bool
)
(
isset
(
$
field
->
primary
)
&&
$field
->
primary
),
'primary'
=>
(
bool
)
(
isset
(
$
column
->
primary
)
&&
$column
->
primary
),
'default'
=>
(
string
)
$
field
->
default
,
'default'
=>
(
string
)
$
column
->
default
,
'notnull'
=>
(
bool
)
(
isset
(
$
field
->
notnull
)
&&
$field
->
notnull
),
'notnull'
=>
(
bool
)
(
isset
(
$
column
->
notnull
)
&&
$column
->
notnull
),
'autoinc'
=>
(
bool
)
(
isset
(
$
field
->
autoincrement
)
&&
$field
->
autoincrement
),
'autoinc'
=>
(
bool
)
(
isset
(
$
column
->
autoincrement
)
&&
$column
->
autoincrement
),
);
);
$columns
[(
string
)
$
field
->
name
]
=
$colDesc
;
$columns
[(
string
)
$
column
->
name
]
=
$colDesc
;
}
}
$tables
[(
string
)
$table
->
name
]
=
$columns
;
$tables
[(
string
)
$table
->
name
]
=
$columns
;
...
...
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