Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dp-ifacesoft committed Mar 17, 2015
1 parent 64a7bb3 commit db51f3b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
11 changes: 10 additions & 1 deletion Source/Ice/Class/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Ice\Core\Loader;
use Ice\Core\Logger;
use Ice\Core\Module;
use Ice\Helper\Object;
use Ice\Helper\Php;

Expand Down Expand Up @@ -43,7 +44,15 @@ public static function create($class, $baseClass = null)
public function generate($data)
{
$namespace = Object::getNamespace($this->_baseClass, $this->_class);
$path = $namespace ? 'Source/' : 'Source/Model/';

$module = Module::getInstance(Object::getModuleAlias($this->_class));

$path = $module->get(Module::SOURCE_DIR);

if ($namespace) {
$path .= 'Model/';
}

$filePath = $filePath = Loader::getFilePath($this->_class, '.php', $path, false, true, true);

$code = file_get_contents($filePath);
Expand Down
9 changes: 8 additions & 1 deletion Source/Ice/Code/Generator/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Ice\Core\Code_Generator;
use Ice\Core\Loader;
use Ice\Core\Logger;
use Ice\Core\Module;
use Ice\Helper\File;
use Ice\Helper\Object;
use Ice\View\Render\Php;
Expand Down Expand Up @@ -50,7 +51,13 @@ public function generate($class, $data, $force = false)
// $class = Object::getClass(Action::getClass(), $data);
$namespace = Object::getNamespace(Action::getClass(), $class);

$path = $namespace ? 'Source/' : 'Source/Class/';
$module = Module::getInstance(Object::getModuleAlias($this->_class));

$path = $module->get(Module::SOURCE_DIR);

if ($namespace) {
$path .= 'Class/';
}

$filePath = Loader::getFilePath($class, '.php', $path, false, true, true);

Expand Down
9 changes: 8 additions & 1 deletion Source/Ice/Code/Generator/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Ice\Core\Loader;
use Ice\Core\Logger;
use Ice\Core\Model as Core_Model;
use Ice\Core\Module;
use Ice\Helper\Arrays;
use Ice\Helper\File;
use Ice\Helper\Object;
Expand Down Expand Up @@ -54,7 +55,13 @@ public function generate($class, $data, $force = false)

$fieldNames = Arrays::column($data['columns'], 'fieldName');

$path = $namespace ? 'Source/' : 'Source/Model/';
$module = Module::getInstance(Object::getModuleAlias($class));

$path = $module->get(Module::SOURCE_DIR);

if ($namespace) {
$path .= 'Model/';
}

$filePath = Loader::getFilePath($class, '.php', $path, false, true, true);

Expand Down
9 changes: 8 additions & 1 deletion Source/Ice/Code/Generator/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Ice\Core\Code_Generator;
use Ice\Core\Loader;
use Ice\Core\Logger;
use Ice\Core\Module;
use Ice\Core\Validator as Core_Validator;
use Ice\Helper\File;
use Ice\Helper\Object;
Expand Down Expand Up @@ -52,7 +53,13 @@ public function generate($class, $data, $force = false)
// $class = Object::getClass(Core_Validator::getClass(), $data);
$namespace = Object::getNamespace(Core_Validator::getClass(), $class);

$path = $namespace ? 'Source/' : 'Source/Class/';
$module = Module::getInstance(Object::getModuleAlias($class));

$path = $module->get(Module::SOURCE_DIR);

if ($namespace) {
$path .= 'Class/';
}

$filePath = Loader::getFilePath($class, '.php', $path, false, true, true);

Expand Down
4 changes: 2 additions & 2 deletions Source/Ice/Core/Data/Scheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static function getTables(Module $module)

self::$_tables = [];

$sourceDir = MODULE_DIR . 'Source/';
$sourceDir = $module->get(Module::SOURCE_DIR);

$Directory = new RecursiveDirectoryIterator(Directory::get($sourceDir . $module->getAlias() . '/Model'));
$Iterator = new RecursiveIteratorIterator($Directory);
Expand Down Expand Up @@ -199,7 +199,7 @@ public static function update(Module $module, $force = false)
Data_Scheme::getLogger()->info(['Removing models from data source {$0}', $dataSourceKey]);
foreach ($schemeTables as $tableName => $table) {
Data_Scheme::getLogger()->info(['Remove model {$0}', $schemeTables[$tableName]['modelClass']]);
unlink(MODULE_DIR . 'Source/' . $table['modelPath']);
unlink($module->get(Module::SOURCE_DIR) . $table['modelPath']);
}
}
}
Expand Down

0 comments on commit db51f3b

Please sign in to comment.