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
0da62430
Commit
0da62430
authored
Oct 25, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to model generation.
parent
bb1e87b0
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
102 deletions
+122
-102
Builder.php
lib/Doctrine/Import/Builder.php
+37
-26
Schema.php
lib/Doctrine/Import/Schema.php
+85
-76
No files found.
lib/Doctrine/Import/Builder.php
View file @
0da62430
...
@@ -38,13 +38,6 @@
...
@@ -38,13 +38,6 @@
*/
*/
class
Doctrine_Import_Builder
class
Doctrine_Import_Builder
{
{
/**
* written
*
* @var array
*/
private
$written
=
array
();
/**
/**
* Path
* Path
*
*
...
@@ -59,7 +52,7 @@ class Doctrine_Import_Builder
...
@@ -59,7 +52,7 @@ class Doctrine_Import_Builder
*
*
* @var string
* @var string
*/
*/
private
$packagePrefix
=
'Package'
;
private
$package
s
Prefix
=
'Package'
;
/**
/**
* packagesPath
* packagesPath
...
@@ -102,6 +95,13 @@ class Doctrine_Import_Builder
...
@@ -102,6 +95,13 @@ class Doctrine_Import_Builder
*/
*/
private
$baseClassesDirectory
=
'generated'
;
private
$baseClassesDirectory
=
'generated'
;
/**
* baseClassName
*
* @var string
*/
private
$baseClassName
=
'Doctrine_Record'
;
/**
/**
* tpl
* tpl
*
*
...
@@ -141,12 +141,12 @@ class Doctrine_Import_Builder
...
@@ -141,12 +141,12 @@ class Doctrine_Import_Builder
/**
/**
* setPackagePath
* setPackagePath
*
*
* @param string $packagePrefix
* @param string $package
s
Prefix
* @return void
* @return void
*/
*/
public
function
setPackage
Prefix
(
$package
Prefix
)
public
function
setPackage
sPrefix
(
$packages
Prefix
)
{
{
$this
->
package
Prefix
=
$package
Prefix
;
$this
->
package
sPrefix
=
$packages
Prefix
;
}
}
/**
/**
...
@@ -204,6 +204,16 @@ class Doctrine_Import_Builder
...
@@ -204,6 +204,16 @@ class Doctrine_Import_Builder
$this
->
baseClassesDirectory
;
$this
->
baseClassesDirectory
;
}
}
/**
* setBaseClassName
*
* @package default
*/
public
function
setBaseClassName
(
$className
)
{
$this
->
baseClassName
=
$className
;
}
/**
/**
* setSuffix
* setSuffix
*
*
...
@@ -289,7 +299,7 @@ END;
...
@@ -289,7 +299,7 @@ END;
$i
=
0
;
$i
=
0
;
if
(
isset
(
$options
[
'inheritance'
][
'extends'
])
&&
!
isset
(
$options
[
'override_parent'
]
))
{
if
(
isset
(
$options
[
'inheritance'
][
'extends'
])
&&
!
(
isset
(
$options
[
'override_parent'
])
&&
$options
[
'override_parent'
]
==
false
))
{
$ret
[
$i
]
=
"
\t\t
parent::setTableDefinition();"
;
$ret
[
$i
]
=
"
\t\t
parent::setTableDefinition();"
;
$i
++
;
$i
++
;
}
}
...
@@ -358,8 +368,11 @@ END;
...
@@ -358,8 +368,11 @@ END;
$ret
[
$i
]
=
$this
->
buildActAs
(
$actAs
);
$ret
[
$i
]
=
$this
->
buildActAs
(
$actAs
);
if
(
!
empty
(
$ret
))
{
$code
=
implode
(
"
\n
"
,
$ret
);
return
"
\n\t
public function setTableDefinition()"
.
"
\n\t
{\n"
.
implode
(
"
\n
"
,
$ret
)
.
"
\n\t
}"
;
$code
=
trim
(
$code
);
if
(
$code
)
{
return
"
\n\t
public function setTableDefinition()"
.
"
\n\t
{
\n\t\t".$code."\n\t
}
"
;
}
}
}
}
...
@@ -539,7 +552,7 @@ END;
...
@@ -539,7 +552,7 @@ END;
$ret
=
array
();
$ret
=
array
();
$i
=
0
;
$i
=
0
;
if
(
!
(
isset
(
$options
[
'override_parent'
])
&&
$options
[
'override_parent'
]
===
tru
e
))
{
if
(
isset
(
$options
[
'inheritance'
][
'extends'
])
&&
!
(
isset
(
$options
[
'override_parent'
])
&&
$options
[
'override_parent'
]
==
fals
e
))
{
$ret
[
$i
]
=
"
\t\t
parent::setUp();"
;
$ret
[
$i
]
=
"
\t\t
parent::setUp();"
;
$i
++
;
$i
++
;
}
}
...
@@ -604,8 +617,11 @@ END;
...
@@ -604,8 +617,11 @@ 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'
]
.
'));'
;
}
}
if
(
!
empty
(
$ret
))
{
$code
=
implode
(
"
\n
"
,
$ret
);
return
"
\n\t
public function setUp()
\n\t
{\n"
.
implode
(
"
\n
"
,
$ret
)
.
"
\n\t
}"
;
$code
=
trim
(
$code
);
if
(
$code
)
{
return
"
\n\t
public function setUp()
\n\t
{
\n\t\t".$code."\n\t
}
"
;
}
}
}
}
...
@@ -629,7 +645,7 @@ END;
...
@@ -629,7 +645,7 @@ END;
$abstract
=
isset
(
$options
[
'abstract'
])
&&
$options
[
'abstract'
]
===
true
?
'abstract '
:
null
;
$abstract
=
isset
(
$options
[
'abstract'
])
&&
$options
[
'abstract'
]
===
true
?
'abstract '
:
null
;
$className
=
$options
[
'className'
];
$className
=
$options
[
'className'
];
$extends
=
isset
(
$options
[
'inheritance'
][
'extends'
])
?
$options
[
'inheritance'
][
'extends'
]
:
'Doctrine_Record'
;
$extends
=
isset
(
$options
[
'inheritance'
][
'extends'
])
?
$options
[
'inheritance'
][
'extends'
]
:
$this
->
baseClassName
;
if
(
!
(
isset
(
$options
[
'no_definition'
])
&&
$options
[
'no_definition'
]
===
true
))
{
if
(
!
(
isset
(
$options
[
'no_definition'
])
&&
$options
[
'no_definition'
]
===
true
))
{
$definition
=
$this
->
buildTableDefinition
(
$options
,
$columns
,
$relations
,
$indexes
,
$attributes
,
$templates
,
$actAs
);
$definition
=
$this
->
buildTableDefinition
(
$options
,
$columns
,
$relations
,
$indexes
,
$attributes
,
$templates
,
$actAs
);
...
@@ -686,7 +702,7 @@ END;
...
@@ -686,7 +702,7 @@ END;
// If we have a package then we need to make this extend the package definition and not the base definition
// If we have a package then we need to make this extend the package definition and not the base definition
// The package definition will then extends the base definition
// The package definition will then extends the base definition
$topLevel
[
'inheritance'
][
'extends'
]
=
(
isset
(
$topLevel
[
'package'
])
&&
$topLevel
[
'package'
])
?
$this
->
packagePrefix
.
$topLevel
[
'className'
]
:
'Base'
.
$topLevel
[
'className'
];
$topLevel
[
'inheritance'
][
'extends'
]
=
(
isset
(
$topLevel
[
'package'
])
&&
$topLevel
[
'package'
])
?
$this
->
package
s
Prefix
.
$topLevel
[
'className'
]
:
'Base'
.
$topLevel
[
'className'
];
$topLevel
[
'no_definition'
]
=
true
;
$topLevel
[
'no_definition'
]
=
true
;
$topLevel
[
'generate_once'
]
=
true
;
$topLevel
[
'generate_once'
]
=
true
;
$topLevel
[
'is_main_class'
]
=
true
;
$topLevel
[
'is_main_class'
]
=
true
;
...
@@ -744,8 +760,6 @@ END;
...
@@ -744,8 +760,6 @@ END;
$writePath
=
$path
.
DIRECTORY_SEPARATOR
.
$className
.
$this
->
suffix
;
$writePath
=
$path
.
DIRECTORY_SEPARATOR
.
$className
.
$this
->
suffix
;
$this
->
written
[
$className
]
=
$writePath
;
if
(
!
file_exists
(
$writePath
))
{
if
(
!
file_exists
(
$writePath
))
{
file_put_contents
(
$writePath
,
$content
);
file_put_contents
(
$writePath
,
$content
);
}
}
...
@@ -835,9 +849,6 @@ END;
...
@@ -835,9 +849,6 @@ END;
$code
.=
PHP_EOL
.
$definition
;
$code
.=
PHP_EOL
.
$definition
;
$this
->
written
[
$options
[
'className'
]]
=
$writePath
;
if
(
isset
(
$options
[
'generate_once'
])
&&
$options
[
'generate_once'
]
===
true
)
{
if
(
isset
(
$options
[
'generate_once'
])
&&
$options
[
'generate_once'
]
===
true
)
{
if
(
!
file_exists
(
$writePath
))
{
if
(
!
file_exists
(
$writePath
))
{
$bytes
=
file_put_contents
(
$writePath
,
$code
);
$bytes
=
file_put_contents
(
$writePath
,
$code
);
...
...
lib/Doctrine/Import/Schema.php
View file @
0da62430
This diff is collapsed.
Click to expand it.
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