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
d2d52a63
Commit
d2d52a63
authored
Oct 05, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaks to generated code.
parent
3f49cc73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
34 deletions
+18
-34
Builder.php
lib/Doctrine/Import/Builder.php
+18
-34
No files found.
lib/Doctrine/Import/Builder.php
View file @
d2d52a63
...
@@ -41,7 +41,7 @@ class Doctrine_Import_Builder
...
@@ -41,7 +41,7 @@ class Doctrine_Import_Builder
*/
*/
private
$path
=
''
;
private
$path
=
''
;
private
$suffix
=
'.php'
;
private
$suffix
=
'.
class.
php'
;
private
$generateBaseClasses
=
false
;
private
$generateBaseClasses
=
false
;
...
@@ -134,15 +134,6 @@ END;
...
@@ -134,15 +134,6 @@ END;
$i
=
0
;
$i
=
0
;
$ret
[
$i
]
=
"
\t\t
public function setTableDefinition()
\n\t\t
{"
;
$i
++
;
if
(
isset
(
$options
[
'inheritance'
])
&&
isset
(
$options
[
'inheritance'
][
'extends'
]))
{
$ret
[
$i
]
=
"
\t\t
parent::setTableDefinition();"
;
$i
++
;
}
if
(
isset
(
$options
[
'tableName'
])
&&
!
empty
(
$options
[
'tableName'
]))
{
if
(
isset
(
$options
[
'tableName'
])
&&
!
empty
(
$options
[
'tableName'
]))
{
$ret
[
$i
]
=
str_repeat
(
' '
,
8
)
.
'$this->setTableName(\''
.
$options
[
'tableName'
]
.
'\');'
;
$ret
[
$i
]
=
str_repeat
(
' '
,
8
)
.
'$this->setTableName(\''
.
$options
[
'tableName'
]
.
'\');'
;
...
@@ -196,7 +187,9 @@ END;
...
@@ -196,7 +187,9 @@ END;
$i
++
;
$i
++
;
}
}
return
implode
(
"
\n
"
,
$ret
)
.
"
\n\t\t
}"
;
if
(
!
empty
(
$ret
))
{
return
"
\n\t\t
public function setTableDefinition()"
.
"
\n\t\t
{\n
\t\t\t\t
parent::setTableDefinition();
\n
"
.
implode
(
"
\n
"
,
$ret
)
.
"
\n\t\t
}"
;
}
}
}
public
function
buildSetUp
(
array
$options
,
array
$columns
,
array
$relations
)
public
function
buildSetUp
(
array
$options
,
array
$columns
,
array
$relations
)
{
{
...
@@ -204,14 +197,6 @@ END;
...
@@ -204,14 +197,6 @@ END;
$i
=
0
;
$i
=
0
;
$ret
[
$i
]
=
"
\t\t
public function setUp()
\n\t\t
{"
;
$i
++
;
if
(
isset
(
$options
[
'inheritance'
])
&&
isset
(
$options
[
'inheritance'
][
'extends'
]))
{
$ret
[
$i
]
=
"
\t\t
parent::setUp();"
;
$i
++
;
}
foreach
(
$relations
as
$name
=>
$relation
)
{
foreach
(
$relations
as
$name
=>
$relation
)
{
$alias
=
(
isset
(
$relation
[
'alias'
])
&&
$relation
[
'alias'
]
!==
$name
)
?
' as '
.
$relation
[
'alias'
]
:
''
;
$alias
=
(
isset
(
$relation
[
'alias'
])
&&
$relation
[
'alias'
]
!==
$name
)
?
' as '
.
$relation
[
'alias'
]
:
''
;
...
@@ -267,7 +252,9 @@ END;
...
@@ -267,7 +252,9 @@ END;
$ret
[
$i
]
=
"
\t\t
"
.
'$this->setInheritanceMap(array(\''
.
$options
[
'inheritance'
][
'keyField'
]
.
'\' => '
.
$options
[
'inheritance'
][
'keyValue'
]
.
'));'
;
$ret
[
$i
]
=
"
\t\t
"
.
'$this->setInheritanceMap(array(\''
.
$options
[
'inheritance'
][
'keyField'
]
.
'\' => '
.
$options
[
'inheritance'
][
'keyValue'
]
.
'));'
;
}
}
return
implode
(
"
\n
"
,
$ret
)
.
"
\n\t\t
}"
;
if
(
!
empty
(
$ret
))
{
return
"
\n\t\t
public function setUp()
\n\t\t
{\n
\t\t\t\t
parent::setUp();
\n\t\t\t\t
"
.
implode
(
"
\n
"
,
$ret
)
.
"
\n\t\t
}"
;
}
}
}
public
function
buildDefinition
(
array
$options
,
array
$columns
,
array
$relations
=
array
())
public
function
buildDefinition
(
array
$options
,
array
$columns
,
array
$relations
=
array
())
...
@@ -279,13 +266,8 @@ END;
...
@@ -279,13 +266,8 @@ END;
$className
=
$options
[
'className'
];
$className
=
$options
[
'className'
];
$extends
=
isset
(
$options
[
'inheritance'
][
'extends'
])
?
$options
[
'inheritance'
][
'extends'
]
:
'Doctrine_Record'
;
$extends
=
isset
(
$options
[
'inheritance'
][
'extends'
])
?
$options
[
'inheritance'
][
'extends'
]
:
'Doctrine_Record'
;
if
(
!
isset
(
$options
[
'inheritance'
][
'extends'
]))
{
$definition
=
$this
->
buildTableDefinition
(
$options
,
$columns
,
$relations
);
$definition
=
$this
->
buildTableDefinition
(
$options
,
$columns
,
$relations
);
$setUp
=
$this
->
buildSetUp
(
$options
,
$columns
,
$relations
);
$setUp
=
$this
->
buildSetUp
(
$options
,
$columns
,
$relations
);
}
else
{
$definition
=
null
;
$setUp
=
null
;
}
$content
=
sprintf
(
self
::
$tpl
,
$className
,
$content
=
sprintf
(
self
::
$tpl
,
$className
,
$extends
,
$extends
,
...
@@ -316,6 +298,7 @@ END;
...
@@ -316,6 +298,7 @@ END;
if
(
$this
->
generateBaseClasses
())
{
if
(
$this
->
generateBaseClasses
())
{
if
(
!
file_exists
(
$options
[
'fileName'
]))
{
$optionsBak
=
$options
;
$optionsBak
=
$options
;
unset
(
$options
[
'tableName'
]);
unset
(
$options
[
'tableName'
]);
...
@@ -323,6 +306,7 @@ END;
...
@@ -323,6 +306,7 @@ END;
$this
->
writeDefinition
(
$options
,
array
(),
array
());
$this
->
writeDefinition
(
$options
,
array
(),
array
());
$options
=
$optionsBak
;
$options
=
$optionsBak
;
}
$generatedPath
=
$this
->
path
.
DIRECTORY_SEPARATOR
.
$this
->
baseClassesDirectory
;
$generatedPath
=
$this
->
path
.
DIRECTORY_SEPARATOR
.
$this
->
baseClassesDirectory
;
...
...
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