From: Vincent Vanwaelscappel Date: Thu, 23 May 2019 17:11:31 +0000 (+0200) Subject: #2783 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f66a626e24f150eb4734694ca0f0381e4ad4fce8;p=cubist_cms-back.git #2783 --- diff --git a/src/app/Console/Commands/MagicCubistCommand.php b/src/app/Console/Commands/MagicCubistCommand.php index ab319d9..a17b733 100644 --- a/src/app/Console/Commands/MagicCubistCommand.php +++ b/src/app/Console/Commands/MagicCubistCommand.php @@ -33,19 +33,19 @@ class MagicCubistCommand extends Command */ public function handle() { + $magic = app_path() . '/Models'; // Find cubistmagic directories - $iterator = Files::getDirectoryIterator(app_path(), true); - $magics = []; - foreach ($iterator as $item) { - /** @var $item \SplFileInfo */ - if ($item->isDir() && $item->getFilename() == 'CubistMagic') { - $this->_handleMagicFolder($item); - } + + if (file_exists($magic)) { + $this->_handleMagicFolder($magic); + } else { + $this->line('No magic folder at ' . $magic); } + $this->executeProcess('composer dump-autoload'); } - protected function _handleMagicFolder(\SplFileInfo $folder) + protected function _handleMagicFolder($folder) { $this->line('Handling folder ' . $folder); $iterator = Files::getDirectoryIterator($folder, true); @@ -113,4 +113,3 @@ class MagicCubistCommand extends Command } } } - diff --git a/src/app/Magic/Models/CubistMagicModelAbstract.php b/src/app/Magic/Models/CubistMagicModelAbstract.php index 03944a4..7f0ca90 100644 --- a/src/app/Magic/Models/CubistMagicModelAbstract.php +++ b/src/app/Magic/Models/CubistMagicModelAbstract.php @@ -83,7 +83,7 @@ class CubistMagicModelAbstract extends Model 'ROUTEURL' => $this->getOption('name'), 'SINGULAR' => $this->getOption('singular', $this->getOption('name')), 'PLURAL' => $this->getOption('plural', ''), - 'MODELNAMESPACE' => __NAMESPACE__ . '\\' . get_class($this), + 'MODELNAMESPACE' => get_class($this), 'FIELDS' => var_export($this->_fields, true) ]; diff --git a/src/resources/cubistmagic/Controller.stub b/src/resources/cubistmagic/Controller.stub index e11f610..dac6d4d 100644 --- a/src/resources/cubistmagic/Controller.stub +++ b/src/resources/cubistmagic/Controller.stub @@ -8,5 +8,5 @@ class _CAMELNAME_CubistMagicController extends CubistMagicController protected $_routeURL = '_ROUTEURL_'; protected $_singular = '_SINGULAR_'; protected $_plural = '_PLURAL_'; - protected $_fields = _FILEDS_; + protected $_fields = _FIELDS_; }