]> _ Git - cubist_cms-back.git/commitdiff
#2783
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 May 2019 17:11:31 +0000 (19:11 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 May 2019 17:11:31 +0000 (19:11 +0200)
src/app/Console/Commands/MagicCubistCommand.php
src/app/Magic/Models/CubistMagicModelAbstract.php
src/resources/cubistmagic/Controller.stub

index ab319d940f062363d1b0378ccdafeea176dd0bab..a17b7330d97c9f4a2dbbb25344b8cbe98fe12604 100644 (file)
@@ -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
         }
     }
 }
-
index 03944a41dfc863768cfcefa6af3727064a376e99..7f0ca90b5217f59f8ae2795239af5f367b461b3b 100644 (file)
@@ -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)
         ];
 
index e11f6103610b222eb5a8de4137f8c5ca4a67bf5e..dac6d4d5575d57c7f3a138bf63ede141a3015fb4 100644 (file)
@@ -8,5 +8,5 @@ class _CAMELNAME_CubistMagicController extends CubistMagicController
     protected $_routeURL = '_ROUTEURL_';
     protected $_singular = '_SINGULAR_';
     protected $_plural = '_PLURAL_';
-    protected $_fields = _FILEDS_;
+    protected $_fields = _FIELDS_;
 }