Example #1
0
 /**
  *  Save the model and its properties
  *
  * @param $modelAndProperties
  * @param $oldModelFile
  * @param bool $storeInArray
  */
 private function saveModelAndProperties($modelAndProperties, $oldModelFile, $storeInArray = true)
 {
     do {
         if (!$this->namespaceGlobal) {
             $this->namespace = "";
         }
         $this->model = new Model($this->command, $oldModelFile, $this->namespace);
         $this->model->generateModel($modelAndProperties);
         if ($storeInArray) {
             $this->models[$this->model->getTableName()] = $this->model;
         }
         if (!$this->namespaceGlobal) {
             $this->fileCreator->namespace = $this->model->getNamespace();
             $this->namespace = $this->model->getNamespace();
         }
         $modelNameCollision = in_array($this->model->lower(), $this->laravelClasses);
     } while ($modelNameCollision);
     $propertiesGenerated = $this->model->generateProperties();
     if (!$propertiesGenerated) {
         if ($this->fromFile) {
             exit;
         } else {
             $this->createModels();
         }
     }
 }