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
e4e1291b
Commit
e4e1291b
authored
Oct 05, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Bug fix for convert mapping to yaml and annotation directory iterating not being recursive
parent
d0bb8ab2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
11 deletions
+30
-11
ConvertMappingTask.php
lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php
+8
-3
SchemaToolTask.php
lib/Doctrine/ORM/Tools/Cli/Tasks/SchemaToolTask.php
+4
-3
ClassMetadataExporter.php
lib/Doctrine/ORM/Tools/Export/ClassMetadataExporter.php
+11
-5
YamlExporter.php
lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
+7
-0
No files found.
lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php
View file @
e4e1291b
...
@@ -90,7 +90,7 @@ class ConvertMappingTask extends AbstractTask
...
@@ -90,7 +90,7 @@ class ConvertMappingTask extends AbstractTask
$printer
->
writeln
(
'You must include a value for all four options: --from, --to and --dest'
,
'ERROR'
);
$printer
->
writeln
(
'You must include a value for all four options: --from, --to and --dest'
,
'ERROR'
);
return
false
;
return
false
;
}
}
if
(
$args
[
'to'
]
!=
'annotation'
&&
$args
[
'extend'
]
)
{
if
(
$args
[
'to'
]
!=
'annotation'
&&
isset
(
$args
[
'extend'
])
)
{
$printer
->
writeln
(
'You can only use the --extend argument when converting to annoations.'
);
$printer
->
writeln
(
'You can only use the --extend argument when converting to annoations.'
);
return
false
;
return
false
;
}
}
...
@@ -133,7 +133,12 @@ class ConvertMappingTask extends AbstractTask
...
@@ -133,7 +133,12 @@ class ConvertMappingTask extends AbstractTask
{
{
throw
new
\InvalidArgumentException
(
sprintf
(
'No schema mapping files found in "%s"'
,
$path
));
throw
new
\InvalidArgumentException
(
sprintf
(
'No schema mapping files found in "%s"'
,
$path
));
}
}
$info
=
pathinfo
(
$files
[
0
]);
$contents
=
file_get_contents
(
$files
[
0
]);
return
$info
[
'extension'
];
if
(
preg_match
(
"/class (.*)/"
,
$contents
))
{
return
'annotation'
;
}
else
{
$info
=
pathinfo
(
$files
[
0
]);
return
$info
[
'extension'
];
}
}
}
}
}
\ No newline at end of file
lib/Doctrine/ORM/Tools/Cli/Tasks/SchemaToolTask.php
View file @
e4e1291b
...
@@ -142,12 +142,13 @@ class SchemaToolTask extends AbstractTask
...
@@ -142,12 +142,13 @@ class SchemaToolTask extends AbstractTask
$classes
=
array
();
$classes
=
array
();
if
(
$driver
instanceof
\Doctrine\ORM\Mapping\Driver\AnnotationDriver
)
{
if
(
$driver
instanceof
\Doctrine\ORM\Mapping\Driver\AnnotationDriver
)
{
$iter
=
new
\FilesystemIterator
(
$args
[
'classdir'
]);
$iter
=
new
\RecursiveIteratorIterator
(
new
\RecursiveDirectoryIterator
(
$args
[
'classdir'
]),
\RecursiveIteratorIterator
::
LEAVES_ONLY
);
$declared
=
get_declared_classes
();
$declared
=
get_declared_classes
();
foreach
(
$iter
as
$item
)
{
foreach
(
$iter
as
$item
)
{
$
baseName
=
$item
->
getBaseName
(
);
$
info
=
pathinfo
(
$item
->
getPathName
()
);
if
(
$baseName
[
0
]
==
'.
'
)
{
if
(
!
isset
(
$info
[
'extension'
])
||
$info
[
'extension'
]
!=
'php
'
)
{
continue
;
continue
;
}
}
require_once
$item
->
getPathName
();
require_once
$item
->
getPathName
();
...
...
lib/Doctrine/ORM/Tools/Export/ClassMetadataExporter.php
View file @
e4e1291b
...
@@ -96,9 +96,14 @@ class ClassMetadataExporter
...
@@ -96,9 +96,14 @@ class ClassMetadataExporter
foreach
(
$this
->
_mappingDirectories
as
$d
)
{
foreach
(
$this
->
_mappingDirectories
as
$d
)
{
list
(
$dir
,
$driver
)
=
$d
;
list
(
$dir
,
$driver
)
=
$d
;
if
(
$driver
==
'php'
)
{
if
(
$driver
==
'php'
)
{
$iter
=
new
\FilesystemIterator
(
$dir
);
$iter
=
new
\RecursiveIteratorIterator
(
new
\RecursiveDirectoryIterator
(
$dir
),
\RecursiveIteratorIterator
::
LEAVES_ONLY
);
foreach
(
$iter
as
$item
)
{
foreach
(
$iter
as
$item
)
{
$info
=
pathinfo
(
$item
->
getPathName
());
if
(
!
isset
(
$info
[
'extension'
])
||
$info
[
'extension'
]
!=
'php'
)
{
continue
;
}
include
$item
->
getPathName
();
include
$item
->
getPathName
();
$vars
=
get_defined_vars
();
$vars
=
get_defined_vars
();
foreach
(
$vars
as
$var
)
{
foreach
(
$vars
as
$var
)
{
...
@@ -111,12 +116,13 @@ class ClassMetadataExporter
...
@@ -111,12 +116,13 @@ class ClassMetadataExporter
$classes
=
array_values
(
$classes
);
$classes
=
array_values
(
$classes
);
}
else
{
}
else
{
if
(
$driver
instanceof
\Doctrine\ORM\Mapping\Driver\AnnotationDriver
)
{
if
(
$driver
instanceof
\Doctrine\ORM\Mapping\Driver\AnnotationDriver
)
{
$iter
=
new
\FilesystemIterator
(
$dir
);
$iter
=
new
\RecursiveIteratorIterator
(
new
\RecursiveDirectoryIterator
(
$dir
),
\RecursiveIteratorIterator
::
LEAVES_ONLY
);
$declared
=
get_declared_classes
();
$declared
=
get_declared_classes
();
foreach
(
$iter
as
$item
)
{
foreach
(
$iter
as
$item
)
{
$
baseName
=
$item
->
getBaseName
(
);
$
info
=
pathinfo
(
$item
->
getPathName
()
);
if
(
$baseName
[
0
]
==
'.
'
)
{
if
(
!
isset
(
$info
[
'extension'
])
||
$info
[
'extension'
]
!=
'php
'
)
{
continue
;
continue
;
}
}
require_once
$item
->
getPathName
();
require_once
$item
->
getPathName
();
...
@@ -125,7 +131,7 @@ class ClassMetadataExporter
...
@@ -125,7 +131,7 @@ class ClassMetadataExporter
foreach
(
$declared
as
$className
)
{
foreach
(
$declared
as
$className
)
{
if
(
!
$driver
->
isTransient
(
$className
))
{
if
(
!
$driver
->
isTransient
(
$className
))
{
$metadata
=
new
ClassMetadata
Info
(
$className
);
$metadata
=
new
ClassMetadata
(
$className
);
$driver
->
loadMetadataForClass
(
$className
,
$metadata
);
$driver
->
loadMetadataForClass
(
$className
,
$metadata
);
$classes
[]
=
$metadata
;
$classes
[]
=
$metadata
;
}
}
...
...
lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
View file @
e4e1291b
...
@@ -27,6 +27,13 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo,
...
@@ -27,6 +27,13 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo,
Doctrine\ORM\Mapping\OneToManyMapping
,
Doctrine\ORM\Mapping\OneToManyMapping
,
Doctrine\ORM\Mapping\ManyToManyMapping
;
Doctrine\ORM\Mapping\ManyToManyMapping
;
if
(
!
class_exists
(
'sfYaml'
,
false
))
{
require_once
__DIR__
.
'/../../../../../vendor/sfYaml/sfYaml.class.php'
;
require_once
__DIR__
.
'/../../../../../vendor/sfYaml/sfYamlDumper.class.php'
;
require_once
__DIR__
.
'/../../../../../vendor/sfYaml/sfYamlInline.class.php'
;
require_once
__DIR__
.
'/../../../../../vendor/sfYaml/sfYamlParser.class.php'
;
}
/**
/**
* ClassMetadata exporter for Doctrine YAML mapping files
* ClassMetadata exporter for Doctrine YAML mapping files
*
*
...
...
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