NerdsAndCompany\Schematic\ConsoleCommands\ExportCommand::actionIndex PHP Метод

actionIndex() публичный Метод

Exports the Craft datamodel.
public actionIndex ( string $file = 'craft/config/schema.yml', array $exclude = null ) : integer
$file string file to write the schema to
$exclude array Data to not export
Результат integer
    public function actionIndex($file = 'craft/config/schema.yml', array $exclude = null)
    {
        $dataTypes = Schematic::getExportableDataTypes();
        // If there are data exclusions.
        if ($exclude !== null) {
            // Find any invalid data to exclude.
            $invalidExcludes = array_diff($exclude, $dataTypes);
            // If any invalid exclusions were specified.
            if (count($invalidExcludes) > 0) {
                $errorMessage = 'Invalid exlude';
                if (count($invalidExcludes) > 1) {
                    $errorMessage .= 's';
                }
                $errorMessage .= ': ' . implode(', ', $invalidExcludes) . '.';
                $errorMessage .= ' Valid exclusions are ' . implode(', ', $dataTypes);
                // Output an error message outlining what invalid exclusions were specified.
                echo "\n" . $errorMessage . "\n\n";
                return 1;
            }
            // Remove any explicitly excluded data types from the list of data types to export.
            $dataTypes = array_diff($dataTypes, $exclude);
        }
        Craft::app()->schematic->exportToYaml($file, $dataTypes);
        Craft::log(Craft::t('Exported schema to {file}', ['file' => $file]));
        return 0;
    }
ExportCommand