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
1e109070
Commit
1e109070
authored
Sep 20, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to make schema importing work.
parent
433035fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
Schema.php
lib/Doctrine/Import/Schema.php
+10
-0
schema.yml
tests/schema.yml
+19
-1
No files found.
lib/Doctrine/Import/Schema.php
View file @
1e109070
...
@@ -106,6 +106,7 @@ abstract class Doctrine_Import_Schema
...
@@ -106,6 +106,7 @@ abstract class Doctrine_Import_Schema
foreach
(
$array
as
$name
=>
$properties
)
{
foreach
(
$array
as
$name
=>
$properties
)
{
$className
=
$properties
[
'className'
];
$className
=
$properties
[
'className'
];
$relations
=
$properties
[
'relations'
];
$relations
=
$properties
[
'relations'
];
$columns
=
$properties
[
'columns'
];
foreach
(
$relations
as
$alias
=>
$relation
)
{
foreach
(
$relations
as
$alias
=>
$relation
)
{
$class
=
isset
(
$relation
[
'class'
])
?
$relation
[
'class'
]
:
$alias
;
$class
=
isset
(
$relation
[
'class'
])
?
$relation
[
'class'
]
:
$alias
;
...
@@ -113,10 +114,17 @@ abstract class Doctrine_Import_Schema
...
@@ -113,10 +114,17 @@ abstract class Doctrine_Import_Schema
$relation
[
'alias'
]
=
$alias
;
$relation
[
'alias'
]
=
$alias
;
$relation
[
'class'
]
=
$class
;
$relation
[
'class'
]
=
$class
;
if
(
isset
(
$relation
[
'type'
])
&&
$relation
[
'type'
])
{
$relation
[
'type'
]
=
$relation
[
'type'
]
===
'one'
?
Doctrine_Relation
::
ONE
:
Doctrine_Relation
::
MANY
;
}
else
{
$relation
[
'type'
]
=
Doctrine_Relation
::
ONE
;
}
$this
->
relations
[
$className
][
$class
]
=
$relation
;
$this
->
relations
[
$className
][
$class
]
=
$relation
;
}
}
}
}
/*
// Fix the other end of the relations
// Fix the other end of the relations
foreach($this->relations as $className => $relations) {
foreach($this->relations as $className => $relations) {
foreach ($relations AS $alias => $relation) {
foreach ($relations AS $alias => $relation) {
...
@@ -125,9 +133,11 @@ abstract class Doctrine_Import_Schema
...
@@ -125,9 +133,11 @@ abstract class Doctrine_Import_Schema
$newRelation['local'] = $relation['foreign'];
$newRelation['local'] = $relation['foreign'];
$newRelation['class'] = $className;
$newRelation['class'] = $className;
$newRelation['alias'] = $className;
$newRelation['alias'] = $className;
$newRelation['type'] = $relation['type'] === Doctrine_Relation::ONE ? Doctrine_Relation::MANY:Doctrine_Relation::ONE;
$this->relations[$relation['class']][$className] = $newRelation;
$this->relations[$relation['class']][$className] = $newRelation;
}
}
}
}
*/
}
}
}
}
\ No newline at end of file
tests/schema.yml
View file @
1e109070
...
@@ -9,6 +9,13 @@ User:
...
@@ -9,6 +9,13 @@ User:
username
:
username
:
type
:
string
type
:
string
length
:
11
length
:
11
relations
:
Groups
:
class
:
Group
refClass
:
UserGroup
local
:
user_id
foreign
:
group_id
type
:
many
UserGroup
:
UserGroup
:
tableName
:
user_group
tableName
:
user_group
...
@@ -17,16 +24,20 @@ UserGroup:
...
@@ -17,16 +24,20 @@ UserGroup:
user_id
:
user_id
:
type
:
int
type
:
int
length
:
11
length
:
11
primary
:
true
group_id
:
group_id
:
type
:
int
type
:
int
length
:
11
length
:
11
primary
:
true
relations
:
relations
:
User
:
User
:
foreign
:
id
foreign
:
id
local
:
user_id
local
:
user_id
type
:
one
Group
:
Group
:
foreign
:
id
foreign
:
id
local
:
group_id
local
:
group_id
type
:
one
Group
:
Group
:
tableName
:
group
tableName
:
group
...
@@ -37,4 +48,11 @@ Group:
...
@@ -37,4 +48,11 @@ Group:
autoincrement
:
true
autoincrement
:
true
name
:
name
:
type
:
string
type
:
string
length
:
255
length
:
255
\ No newline at end of file
relations
:
Users
:
class
:
User
refClass
:
UserGroup
local
:
group_id
foreign
:
user_id
type
:
many
\ No newline at end of file
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