/**
  * @return string[]
  */
 private function getProjectMigrations()
 {
     return FilesystemFlow::glob("{$this->migrationsPath}/*.php")->keys()->sort()->map(function ($path, &$i) {
         $i = str_segmentsFirst(basename($path), '_');
         return [Migration::date => $i, Migration::name => Migration::nameFromFilename($path), Migration::module => $this->module->name, Migration::path => $path];
     })->all();
 }
Пример #2
0
 private function outputField($input, $i, $id, $name, $langR = null)
 {
     if ($bind = $this->props->bind) {
         $name = str_segmentsFirst($bind, '|');
     }
     $lang = $langR ? $langR['name'] : '';
     $_lang = $lang ? "_{$lang}" : '';
     $name = "{$name}{$_lang}";
     /** @var InputProperties $prop */
     $prop = $input->props;
     // EMBEDDED COMPONENTS
     if ($input instanceof HtmlComponent) {
         /** @var HtmlComponent $input */
         if ($id) {
             $prop->id = "{$id}-{$i}{$_lang}";
         }
         // note: can't use dots, as PHP would replace them by underscores when loading the form fields
         $prop->name = str_replace('.', '/', $name);
         if (!$i) {
             $input->originalCssClassName = $input->cssClassName;
         }
         if ($lang) {
             $input->htmlAttrs['lang'] = $lang;
         }
         if ($this->props->required && $prop->defines('required')) {
             $prop->required = true;
         }
         if ($this->props->readOnly && $prop->defines('readOnly')) {
             $prop->readOnly = true;
         }
         if (exists($this->props->defaultValue)) {
             $prop->defaultValue = $this->props->defaultValue;
         }
         if ($bind) {
             $valuefield = $prop->defines('testValue') ? 'testValue' : 'value';
             $input->addBinding($valuefield, new Expression("{{$bind}}"));
         }
     }
     $input->run();
 }