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
32a81f09
Commit
32a81f09
authored
Apr 14, 2010
by
Jonathan H. Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing generate-repositories command so it works again after migration to Symfony console
parent
146b22a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
GenerateRepositoriesCommand.php
...ORM/Tools/Console/Command/GenerateRepositoriesCommand.php
+20
-6
No files found.
lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php
View file @
32a81f09
...
...
@@ -40,12 +40,12 @@ use Symfony\Components\Console\Input\InputArgument,
*/
class
GenerateRepositoriesCommand
extends
Console\Command\Command
{
pr
ivate
static
$_template
=
pr
otected
static
$_template
=
'<?php
namespace <namespace>;
use
\
Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityRepository;
/**
* <className>
...
...
@@ -103,7 +103,7 @@ EOT
);
}
if
(
count
(
$metadatas
))
{
if
(
count
(
$metadatas
))
{
$numRepositories
=
0
;
foreach
(
$metadatas
as
$metadata
)
{
...
...
@@ -112,7 +112,7 @@ EOT
sprintf
(
'Processing repository "<info>%s</info>"'
,
$metadata
->
customRepositoryClassName
)
.
PHP_EOL
);
$this
->
_
genera
teRepositoryClass
(
$metadata
,
$destPath
);
$this
->
_
wri
teRepositoryClass
(
$metadata
,
$destPath
);
$numRepositories
++
;
}
...
...
@@ -129,9 +129,23 @@ EOT
}
}
pr
ivate
function
_generateRepositoryClass
(
$metadata
,
$destPath
)
pr
otected
function
_generateRepositoryClass
(
$metadata
)
{
$code
=
$this
->
_generateRepositoryClass
(
$metadata
->
customRepositoryClassName
);
fullClassName
=
$metadata
->
customRepositoryClassName
;
$namespace
=
substr
(
$fullClassName
,
0
,
strrpos
(
$fullClassName
,
'\\'
));
$className
=
substr
(
$fullClassName
,
strrpos
(
$fullClassName
,
'\\'
)
+
1
,
strlen
(
$fullClassName
));
$variables
=
array
(
'<namespace>'
=>
$namespace
,
'<className>'
=>
$className
);
$code
=
str_replace
(
array_keys
(
$variables
),
array_values
(
$variables
),
self
::
$_template
);
return
$code
;
}
protected
function
_writeRepositoryClass
(
$metadata
,
$destPath
)
{
$code
=
$this
->
_generateRepositoryClass
(
$metadata
);
$path
=
$destPath
.
DIRECTORY_SEPARATOR
.
str_replace
(
'\\'
,
\DIRECTORY_SEPARATOR
,
$metadata
->
customRepositoryClassName
)
.
'.php'
;
...
...
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