Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function beforeValidate()
 {
     if ($this->template == 'base') {
         $this->ns = 'app\\base\\models';
     } else {
         $this->ns = 'app\\models';
     }
     return parent::beforeValidate();
 }
Ejemplo n.º 2
0
 public function beforeValidate()
 {
     $options = ArrayHelper::merge($this->tableBuilder, ['tableNameRequired' => $this->createTable, 'autoCreateTable' => $this->createTable]);
     $this->tableBuilder = new TableGenerator($options);
     $this->tableBuilder->forceTableCreate = $this->createTable = false;
     $result = $this->tableBuilder->validate() && parent::beforeValidate();
     if (!$result) {
         foreach ($this->behaviorModels as &$behaviorModel) {
             if (is_array($behaviorModel)) {
                 $behaviorModel = new Behaviors($behaviorModel);
             }
         }
     } else {
         $this->tableBuilder->tableName = $this->tableBuilder->tableName ?: $this->tableName;
         $this->files = $this->tableBuilder->generate();
     }
     return $result;
 }