+++ /dev/null
-<?php
-
-class IPF_ORM_Builder
-{
- public function varExport($var)
- {
- $export = var_export($var, true);
- $export = str_replace("\n", '', $export);
- $export = str_replace(' ', ' ', $export);
- $export = str_replace('array ( ', 'array(', $export);
- $export = str_replace('array( ', 'array(', $export);
- $export = str_replace(',)', ')', $export);
- $export = str_replace(', )', ')', $export);
- $export = str_replace(' ', ' ', $export);
-
- return $export;
- }
-}
\ No newline at end of file
<?php
-class IPF_ORM_Import_Builder extends IPF_ORM_Builder
+class IPF_ORM_Import_Builder
{
protected $_path = '';
protected $_packagesPrefix = 'Package';
protected $_baseClassName = 'IPF_ORM_Record';
protected $_generateAccessors = false;
protected static $_tpl;
+
+ private static function varExport($var)
+ {
+ $export = var_export($var, true);
+ $export = str_replace("\n", '', $export);
+ $export = str_replace(' ', ' ', $export);
+ $export = str_replace('array ( ', 'array(', $export);
+ $export = str_replace('array( ', 'array(', $export);
+ $export = str_replace(',)', ')', $export);
+ $export = str_replace(', )', ')', $export);
+ $export = str_replace(' ', ' ', $export);
+ return $export;
+ }
+
public function __construct()
{
$this->loadTemplate();
}
if (isset($definition['inheritance']['subclasses']) && ! empty($definition['inheritance']['subclasses'])) {
- $ret[$i] = " ".'$this->setSubClasses('. $this->varExport($definition['inheritance']['subclasses']).');';
+ $ret[$i] = " ".'$this->setSubClasses('. self::varExport($definition['inheritance']['subclasses']).');';
$i++;
}
$a = array();
if (isset($relation['refClass'])) {
- $a[] = '\'refClass\' => ' . $this->varExport($relation['refClass']);
+ $a[] = '\'refClass\' => ' . self::varExport($relation['refClass']);
}
if (isset($relation['deferred']) && $relation['deferred']) {
- $a[] = '\'default\' => ' . $this->varExport($relation['deferred']);
+ $a[] = '\'default\' => ' . self::varExport($relation['deferred']);
}
if (isset($relation['local']) && $relation['local']) {
- $a[] = '\'local\' => ' . $this->varExport($relation['local']);
+ $a[] = '\'local\' => ' . self::varExport($relation['local']);
}
if (isset($relation['foreign']) && $relation['foreign']) {
- $a[] = '\'foreign\' => ' . $this->varExport($relation['foreign']);
+ $a[] = '\'foreign\' => ' . self::varExport($relation['foreign']);
}
if (isset($relation['onDelete']) && $relation['onDelete']) {
- $a[] = '\'onDelete\' => ' . $this->varExport($relation['onDelete']);
+ $a[] = '\'onDelete\' => ' . self::varExport($relation['onDelete']);
}
if (isset($relation['onUpdate']) && $relation['onUpdate']) {
- $a[] = '\'onUpdate\' => ' . $this->varExport($relation['onUpdate']);
+ $a[] = '\'onUpdate\' => ' . self::varExport($relation['onUpdate']);
}
if (isset($relation['equal']) && $relation['equal']) {
- $a[] = '\'equal\' => ' . $this->varExport($relation['equal']);
+ $a[] = '\'equal\' => ' . self::varExport($relation['equal']);
}
if (isset($relation['owningSide']) && $relation['owningSide']) {
- $a[] = '\'owningSide\' => ' . $this->varExport($relation['owningSide']);
+ $a[] = '\'owningSide\' => ' . self::varExport($relation['owningSide']);
}
if ( ! empty($a)) {
}
if (is_array($options) && !empty($options)) {
- $build .= ', ' . $this->varExport($options);
+ $build .= ', ' . self::varExport($options);
}
$build .= ');' . PHP_EOL;
foreach ($templates as $name => $options) {
if (is_array($options) && !empty($options)) {
- $optionsPhp = $this->varExport($options);
+ $optionsPhp = self::varExport($options);
$build .= " \$this->loadTemplate('" . $name . "', " . $optionsPhp . ");" . PHP_EOL;
} else {
}
}
- $optionPHP = $this->varExport($realOptions);
+ $optionPHP = self::varExport($realOptions);
$build .= $this->emitAssign($level, $template, $optionPHP);
if ($level == 0) {
$emittedActAs[] = $this->emitActAs($level, $template);
{
$build = '';
foreach ($options as $name => $value) {
- $build .= " \$this->option('$name', " . $this->varExport($value) . ");" . PHP_EOL;
+ $build .= " \$this->option('$name', " . self::varExport($value) . ");" . PHP_EOL;
}
return $build;
foreach ($indexes as $indexName => $definitions) {
$build .= PHP_EOL . " \$this->index('" . $indexName . "'";
- $build .= ', ' . $this->varExport($definitions);
+ $build .= ', ' . self::varExport($definitions);
$build .= ');';
}
IPF_ORM::loadModel($definition['className'], $writePath);
}
}
+