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
93445983
Commit
93445983
authored
Sep 12, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Changes to convert Classmetadata constant integers to string representation
parent
320d21e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
7 deletions
+81
-7
YamlDriver.php
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
+3
-2
AbstractExporter.php
lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php
+66
-0
YamlExporter.php
lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
+12
-5
No files found.
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
View file @
93445983
...
...
@@ -72,7 +72,7 @@ class YamlDriver extends AbstractFileDriver
}
if
(
isset
(
$element
[
'inheritanceType'
]))
{
$metadata
->
setInheritanceType
(
$element
[
'inheritanceType'
]
);
$metadata
->
setInheritanceType
(
constant
(
'Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_'
.
$element
[
'inheritanceType'
])
);
}
// Evaluate discriminatorColumn
...
...
@@ -92,7 +92,8 @@ class YamlDriver extends AbstractFileDriver
// Evaluate changeTrackingPolicy
if
(
isset
(
$element
[
'changeTrackingPolicy'
]))
{
$metadata
->
setChangeTrackingPolicy
(
$element
[
'changeTrackingPolicy'
]);
$metadata
->
setChangeTrackingPolicy
(
constant
(
'Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_'
.
$element
[
'changeTrackingPolicy'
]));
}
// Evaluate indexes
...
...
lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php
View file @
93445983
...
...
@@ -70,6 +70,10 @@ abstract class AbstractExporter
*/
public
function
export
()
{
if
(
!
is_dir
(
$this
->
_outputDir
))
{
mkdir
(
$this
->
_outputDir
,
0777
);
}
foreach
(
$this
->
_metadatas
as
$metadata
)
{
$outputPath
=
$this
->
_outputDir
.
'/'
.
str_replace
(
'\\'
,
'.'
,
$metadata
->
name
)
.
$this
->
_extension
;
$output
=
$this
->
exportClassMetadata
(
$metadata
);
...
...
@@ -101,4 +105,66 @@ abstract class AbstractExporter
* @return mixed $exported
*/
abstract
public
function
exportClassMetadata
(
ClassMetadata
$metadata
);
protected
function
_getInheritanceTypeString
(
$type
)
{
switch
(
$type
)
{
case
Classmetadata
::
INHERITANCE_TYPE_NONE
:
return
'NONE'
;
break
;
case
Classmetadata
::
INHERITANCE_TYPE_JOINED
:
return
'JOINED'
;
break
;
case
Classmetadata
::
INHERITANCE_TYPE_SINGLE_TABLE
:
return
'SINGLE_TABLE'
;
break
;
case
Classmetadata
::
INHERITANCE_TYPE_TABLE_PER_CLASS
:
return
'PER_CLASS'
;
break
;
}
}
protected
function
_getChangeTrackingPolicyString
(
$policy
)
{
switch
(
$policy
)
{
case
Classmetadata
::
CHANGETRACKING_DEFERRED_IMPLICIT
:
return
'DEFERRED_IMPLICIT'
;
break
;
case
Classmetadata
::
CHANGETRACKING_DEFERRED_EXPLICIT
:
return
'DEFERRED_EXPLICIT'
;
break
;
case
Classmetadata
::
CHANGETRACKING_NOTIFY
:
return
'NOTIFY'
;
break
;
}
}
protected
function
_getIdGeneratorTypeString
(
$type
)
{
switch
(
$type
)
{
case
Classmetadata
::
GENERATOR_TYPE_AUTO
:
return
'AUTO'
;
break
;
case
Classmetadata
::
GENERATOR_TYPE_SEQUENCE
:
return
'SEQUENCE'
;
break
;
case
Classmetadata
::
GENERATOR_TYPE_TABLE
:
return
'TABLE'
;
break
;
case
Classmetadata
::
GENERATOR_TYPE_IDENTITY
:
return
'IDENTITY'
;
break
;
}
}
}
\ No newline at end of file
lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
View file @
93445983
...
...
@@ -59,10 +59,17 @@ class YamlExporter extends AbstractExporter
$array
[
'schema'
]
=
$metadata
->
primaryTable
[
'schema'
];
}
$array
[
'inheritanceType'
]
=
$metadata
->
getInheritanceType
();
$array
[
'discriminatorColumn'
]
=
$metadata
->
getDiscriminatorColumn
();
$array
[
'discriminatorMap'
]
=
$metadata
->
discriminatorMap
;
$array
[
'changeTrackingPolicy'
]
=
$metadata
->
changeTrackingPolicy
;
$array
[
'inheritanceType'
]
=
$this
->
_getInheritanceTypeString
(
$metadata
->
getInheritanceType
());
if
(
$column
=
$metadata
->
getDiscriminatorColumn
())
{
$array
[
'discriminatorColumn'
]
=
$column
;
}
if
(
$map
=
$metadata
->
discriminatorMap
)
{
$array
[
'discriminatorMap'
]
=
$map
;
}
$array
[
'changeTrackingPolicy'
]
=
$this
->
_getChangeTrackingPolicyString
(
$metadata
->
changeTrackingPolicy
);
if
(
isset
(
$metadata
->
primaryTable
[
'indexes'
]))
{
$array
[
'indexes'
]
=
$metadata
->
primaryTable
[
'indexes'
];
...
...
@@ -82,7 +89,7 @@ class YamlExporter extends AbstractExporter
}
}
if
(
$idGeneratorType
=
$
metadata
->
getIdGeneratorType
(
))
{
if
(
$idGeneratorType
=
$
this
->
_getIdGeneratorTypeString
(
$metadata
->
getIdGeneratorType
()
))
{
$id
[
$metadata
->
getSingleIdentifierFieldName
()][
'generator'
][
'strategy'
]
=
$idGeneratorType
;
}
...
...
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