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
102f1068
Commit
102f1068
authored
Oct 08, 2007
by
gnat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix class generation of yml schema fully defined m2m relationships.
parent
6b26a7b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
Schema.php
lib/Doctrine/Import/Schema.php
+14
-6
No files found.
lib/Doctrine/Import/Schema.php
View file @
102f1068
...
...
@@ -189,8 +189,8 @@ class Doctrine_Import_Schema
$relation
[
'type'
]
=
Doctrine_Relation
::
ONE
;
}
if
(
isset
(
$relation
[
'f
type'
])
&&
$relation
[
'ft
ype'
])
{
$relation
[
'f
type'
]
=
$relation
[
'ft
ype'
]
===
'one'
?
Doctrine_Relation
::
ONE
:
Doctrine_Relation
::
MANY
;
if
(
isset
(
$relation
[
'f
oreignType'
])
&&
$relation
[
'foreignT
ype'
])
{
$relation
[
'f
oreignType'
]
=
$relation
[
'foreignT
ype'
]
===
'one'
?
Doctrine_Relation
::
ONE
:
Doctrine_Relation
::
MANY
;
}
if
(
isset
(
$relation
[
'refClass'
])
&&
!
empty
(
$relation
[
'refClass'
])
&&
(
!
isset
(
$array
[
$relation
[
'refClass'
]][
'relations'
])
||
empty
(
$array
[
$relation
[
'refClass'
]][
'relations'
])))
{
...
...
@@ -212,21 +212,29 @@ class Doctrine_Import_Schema
// define both sides of the relationship
foreach
(
$this
->
relations
as
$className
=>
$relations
)
{
foreach
(
$relations
AS
$alias
=>
$relation
)
{
if
(
isset
(
$relation
[
'ignore'
])
&&
$relation
[
'ignore'
]
||
isset
(
$relation
[
'refClass'
])
)
if
(
isset
(
$relation
[
'ignore'
])
&&
$relation
[
'ignore'
]
||
isset
(
$relation
[
'refClass'
])
||
isset
(
$this
->
relations
[
$relation
[
'class'
]][
'relations'
][
$className
]))
{
continue
;
}
$newRelation
=
array
();
$newRelation
[
'foreign'
]
=
$relation
[
'local'
];
$newRelation
[
'local'
]
=
$relation
[
'foreign'
];
$newRelation
[
'class'
]
=
$className
;
$newRelation
[
'alias'
]
=
isset
(
$relation
[
'foreignAlias'
])
?
$relation
[
'foreignAlias'
]
:
$className
;
if
(
isset
(
$relation
[
'f
t
ype'
]))
{
$newRelation
[
'type'
]
=
$relation
[
'f
t
ype'
];
if
(
isset
(
$relation
[
'f
oreignT
ype'
]))
{
$newRelation
[
'type'
]
=
$relation
[
'f
oreignT
ype'
];
}
else
{
$newRelation
[
'type'
]
=
$relation
[
'type'
]
===
Doctrine_Relation
::
ONE
?
Doctrine_Relation
::
MANY
:
Doctrine_Relation
::
ONE
;
}
$this
->
relations
[
$relation
[
'class'
]][
$className
]
=
$newRelation
;
if
(
isset
(
$this
->
relations
[
$relation
[
'class'
]])
&&
is_array
(
$this
->
relations
[
$relation
[
'class'
]])
)
{
foreach
(
$this
->
relations
[
$relation
[
'class'
]]
as
$otherRelation
)
{
if
(
isset
(
$otherRelation
[
'refClass'
])
&&
$otherRelation
[
'refClass'
]
==
$className
)
// skip fully defined m2m relationships
return
;
}
}
else
$this
->
relations
[
$relation
[
'class'
]][
$className
]
=
$newRelation
;
}
}
}
...
...
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