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
2acd3062
Commit
2acd3062
authored
Jun 27, 2007
by
nicobn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a new method to give more options to the user.
parent
81d39c50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
23 deletions
+37
-23
Builder.php
lib/Doctrine/Import/Builder.php
+37
-23
No files found.
lib/Doctrine/Import/Builder.php
View file @
2acd3062
...
...
@@ -109,29 +109,15 @@ END;
}
public function buildRecord($table, $tableColumns, $className='', $fileName='')
/*
* Build the table definition of a Doctrine_Record object
*
* @param string $table
* @param array $tableColumns
* @access public
*/
public function buildDefinition($table, $tableColumns)
{
if (empty($fileName)) {
if (empty($this->path)) {
$errMsg = 'No build target directory set.';
throw new Doctrine_Import_Builder_Exception($errMsg);
}
if (is_writable($this->path) === false) {
$errMsg = 'Build target directory ' . $this->path . ' is not writable.';
throw new Doctrine_Import_Builder_Exception($errMsg);
}
$fileName = $this->path . DIRECTORY_SEPARATOR . $className . $this->suffix;
}
$created = date('l dS \of F Y h:i:s A');
if (empty($className)) {
$className = Doctrine::classify($table);
}
$columns = array(0 => str_repeat(' ', 8) . '$this->setTableName(\'$table\');');
$i = 1;
...
...
@@ -179,8 +165,35 @@ END;
}
$
i
++;
}
return
implode
("\
n
",
$
columns
);
}
$
content =
sprintf(self::$tpl,
$
created
,
$
className
,
implode
("\
n
",
$
columns
));
public
function
buildRecord
($
table
,
$
tableColumns
,
$
className=
''
,
$
fileName=
''
)
{
if
(
empty
($
fileName
))
{
if
(
empty
($
this-
>
path)) {
$errMsg = 'No build target directory set.';
throw new Doctrine_Import_Builder_Exception($errMsg);
}
if (is_writable($this->path) === false) {
$errMsg = 'Build target directory ' . $this->path . ' is not writable.';
throw new Doctrine_Import_Builder_Exception($errMsg);
}
$fileName = $this->path . DIRECTORY_SEPARATOR . $className . $this->suffix;
}
$created = date('l dS \of F Y h:i:s A');
if (empty($className)) {
$className = Doctrine::classify($table);
}
$content = sprintf(self::$tpl, $created, $className,
$this->buildDefinition($table, $tableColumns));
$bytes = file_put_contents($fileName, $content);
...
...
@@ -188,6 +201,7 @@ END;
throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $fileName);
}
}
/**
*
* @param Doctrine_Schema_Object $schema
...
...
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