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
1dc60451
Commit
1dc60451
authored
Sep 17, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for new yml schema.
parent
2279cf8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
33 deletions
+14
-33
Schema.php
lib/Doctrine/Import/Schema.php
+12
-26
Yml.php
lib/Doctrine/Import/Schema/Yml.php
+2
-7
No files found.
lib/Doctrine/Import/Schema.php
View file @
1dc60451
...
...
@@ -39,7 +39,7 @@
*/
abstract
class
Doctrine_Import_Schema
{
public
$relation
Column
s
=
array
();
public
$relations
=
array
();
/**
* Parse the schema and return it in an array
...
...
@@ -86,7 +86,7 @@ abstract class Doctrine_Import_Schema
$array
=
array_merge
(
$array
,
$this
->
parseSchema
(
$s
));
}
$this
->
buildRelations
(
$array
);
$this
->
buildRelations
hips
(
$array
);
foreach
(
$array
as
$name
=>
$properties
)
{
$options
=
array
();
...
...
@@ -101,34 +101,20 @@ abstract class Doctrine_Import_Schema
}
}
public
function
buildRelations
(
$array
)
public
function
buildRelations
hips
(
$array
)
{
foreach
(
$array
AS
$name
=>
$properties
)
{
$className
=
$properties
[
'className'
];
$columns
=
$properties
[
'columns'
];
foreach
(
$columns
as
$column
)
{
if
(
$this
->
isRelation
(
$column
))
{
$this
->
addRelationColumn
(
$className
,
$column
);
}
$relations
=
$properties
[
'relations'
];
foreach
(
$relations
AS
$alias
=>
$relation
)
{
$class
=
isset
(
$relation
[
'class'
])
?
$relation
[
'class'
]
:
$alias
;
$relation
[
'alias'
]
=
$alias
;
$relation
[
'class'
]
=
$class
;
$this
->
relations
[
$className
][
$class
]
=
$relation
;
}
}
$this
->
processRelationships
();
}
public
function
isRelation
(
$column
)
{
return
isset
(
$column
[
'foreignClass'
])
&&
isset
(
$column
[
'foreignReference'
]);
}
public
function
addRelationColumn
(
$className
,
$column
)
{
$this
->
relationColumns
[
$className
][]
=
$column
;
}
public
function
processRelationships
()
{
}
}
\ No newline at end of file
lib/Doctrine/Import/Schema/Yml.php
View file @
1dc60451
...
...
@@ -51,6 +51,7 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
public
function
parseSchema
(
$schema
)
{
$array
=
$this
->
parse
(
$schema
);
foreach
(
$array
as
$tableName
=>
$table
)
{
$columns
=
array
();
...
...
@@ -70,13 +71,6 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
$colDesc
[
'default'
]
=
isset
(
$field
[
'default'
])
?
(
string
)
$field
[
'default'
]
:
null
;
$colDesc
[
'notnull'
]
=
isset
(
$field
[
'notnull'
])
?
(
bool
)
(
isset
(
$field
[
'notnull'
])
&&
$field
[
'notnull'
])
:
null
;
$colDesc
[
'autoinc'
]
=
isset
(
$field
[
'autoinc'
])
?
(
bool
)
(
isset
(
$field
[
'autoinc'
])
&&
$field
[
'autoinc'
])
:
null
;
$colDesc
[
'foreignClass'
]
=
isset
(
$field
[
'foreignClass'
])
?
(
string
)
$field
[
'foreignClass'
]
:
null
;
$colDesc
[
'foreignReference'
]
=
isset
(
$field
[
'foreignReference'
])
?
(
string
)
$field
[
'foreignReference'
]
:
null
;
$colDesc
[
'localName'
]
=
isset
(
$field
[
'localName'
])
?
(
string
)
$field
[
'localName'
]
:
null
;
$colDesc
[
'foreignName'
]
=
isset
(
$field
[
'foreignName'
])
?
(
string
)
$field
[
'foreignName'
]
:
null
;
$colDesc
[
'counterpart'
]
=
isset
(
$field
[
'counterpart'
])
?
(
string
)
$field
[
'counterpart'
]
:
null
;
$colDesc
[
'onDelete'
]
=
isset
(
$field
[
'onDelete'
])
?
(
string
)
$field
[
'onDelete'
]
:
null
;
$colDesc
[
'onUpdate'
]
=
isset
(
$field
[
'onUpdate'
])
?
(
string
)
$field
[
'onUpdate'
]
:
null
;
$columns
[(
string
)
$colDesc
[
'name'
]]
=
$colDesc
;
}
...
...
@@ -85,6 +79,7 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
$tables
[
$tableName
][
'className'
]
=
$className
;
$tables
[
$tableName
][
'columns'
]
=
$columns
;
$tables
[
$tableName
][
'relations'
]
=
isset
(
$table
[
'relations'
])
?
$table
[
'relations'
]
:
array
();
}
return
$tables
;
...
...
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