Run seeds on a module.

@param ModuleContainerInterface $module
@param array                    $data

@return $this
768449
public function seedModule(ModuleContainerInterface $module, array $data = [])
    {
        $className = $module->getNamespace().'\\database\\seeds\\DatabaseSeeder';

        if (!class_exists($className)) {
            return false;
        }

        $seeder = app($className, $data);
        $seeder->run();

        $this->output(sprintf('<info>Seeded %s</info> ', $module));

        return $this;
    }
739246
public function run(string $module, array $options = []) : int
    {
        $views = Configure::read('CsvMigrations.actions');
        $options = $this->applyOptionDefaults($options);

        $viewCounter = 0;
        foreach ($views as $view) {
            $path = '';
            $mc = $this->getModuleConfig($module, $view, $options);

            try {
                $path = $mc->find();
            } catch (InvalidArgumentException $e) {
                // It's OK for view files to be missing.
                // For example, Files and Users modules.
                $this->warnings[] = sprintf('%s module [%s] view file is missing', $module, $view);
                continue;
            }

            /**
             * If the view file does exist, it has to be parseable.
             */
            $viewCounter++;
            $seenFields = $fields = [];
            try {
                $config = $mc->parse();
                $fields = property_exists($config, 'items') ? $config->items : [];
            } catch (InvalidArgumentException $e) {
                $this->errors = array_merge($this->errors, $mc->getErrors());
                $this->warnings = array_merge($this->warnings, $mc->getWarnings());

                continue;
            }

            if (empty($fields)) {
                $this->warnings[] = sprintf('%s module [%s] view file is empty', $module, $view);
                continue;
            }

            foreach ($fields as $field) {
                $field = array_map('trim', $field);

                // Get rid of the first column, which is the panel name
                if (count($field) > 1) {
                    array_shift($field);
                }

                foreach ($field as $column) {
                    if ($column === '') {
                        continue;
                    }

                    // embedded field detection
                    preg_match(CsvField::PATTERN_TYPE, $column, $matches);

                    // embedded field flag
                    $isEmbedded = ! empty($matches[1]) && 'EMBEDDED' === $matches[1];

                    // association field flag
                    $isAssociation = ! empty($matches[1]) && 'ASSOCIATION' === $matches[1];

                    // normal field
                    if (! $isAssociation && ! $isEmbedded && ! Utility::isValidModuleField($module, $column)) {
                        $this->errors[] = sprintf(
                            '%s module [%s] view references unknown field "%s"',
                            $module,
                            $view,
                            $column
                        );

                        continue;
                    }

                    // Check for field duplicates
                    if (in_array($view, $options['duplicateCheck'])) {
                        if (in_array($column, $seenFields)) {
                            $this->errors[] = $module . " module [$view] specifies field '" . $column . "' more than once";
                            continue;
                        }
                    }
                    $seenFields[] = $column;

                    if ($isEmbedded) {
                        $this->validateEmbedded($matches[2], $module, $view);
                    }

                    if ($isAssociation) {
                        $this->validateAssociation($matches[2], $module, $view);
                    }
                }
            }
        }

        // Warn if the module is missing standard views
        if ($viewCounter < count($views)) {
            $this->warnings[] = sprintf('%s module has only %d views.', $module, $viewCounter);
        }

        return count($this->errors);
    }
872664
protected function processModule($moduleId, array $moduleData)
    {
        $this->resetTemporaryModelCache();

        // fill cache with current module's data
        $this->moduleId = $moduleId;
        $this->module   = $moduleData;

        // set default model data
        $this->model = [
            'module'                => $moduleId,
            'name'                  => $this->normalizeModelName($this->module['name']),
            'table'                 => null,
            'cached'                => config('pxlcms.generator.models.enable_rememberable_cache'),
            'is_translated'         => false,
            'is_translation'        => false,
            'is_listified'          => false,
            'ordered_by'            => [],
            'timestamps'            => null,
            // attributes
            'normal_fillable'       => [],
            'translated_fillable'   => [],
            'hidden'                => [],
            'casts'                 => [],
            'dates'                 => [],
            'defaults'              => [],
            'normal_attributes'     => [],
            'translated_attributes' => [],
            // categories
            'has_categories'        => (bool) array_get($this->module, 'client_cat_control'),
            // relationships
            'relations_config'      => [],
            'relationships'         => [
                'normal'   => [],
                'reverse'  => [],
                'image'    => [],
                'file'     => [],
                'checkbox' => [],
            ],
            // special
            'sluggable'       => false,
            'sluggable_setup' => [],
            'scope_active'    => null,   // config determines
            'scope_position'  => null,   // config determines
        ];

        // process manual/automatic sorting of entries
        $this->processModuleSorting();

        // set overrides in model data
        $this->prepareModelOverrides();

        // add module fields as attribute data
        $this->processModuleFields();

        // override relationship data found while processing fields
        $this->applyOverridesForRelationships();

        // make sure we do not use a reserved class name
        $this->checkForReservedClassName($this->model['name']);

        // save completely built up model to context
        $this->context->output['models'][ $moduleId ] = $this->model;
    }
350974
public function findByModule(ModuleInterface $module = null, array $orderBy = null, $limit = null, $offset = null)
    {
        $criteria = [];

        if ($this->isModular($module)) {
            $criteria['module'] = $module;
        }

        /** @var EntityRepository $this */
        return $this->findBy($criteria, $orderBy, $limit, $offset);
    }
445183
protected function _addExtensions(\OxidEsales\Eshop\Core\Module\Module $module)
    {
        $modules = $this->_removeNotUsedExtensions($this->getModulesWithExtendedClass(), $module);

        if ($module->hasExtendClass()) {
            $this->validateMetadataExtendSection($module);
            $addModules = $module->getExtensions();
            $modules = $this->_mergeModuleArrays($modules, $addModules);
        }

        $modules = $this->buildModuleChains($modules);

        $this->_saveToConfig('aModules', $modules);
    }
813505
public function _before(TestInterface $test)
    {
        /** @noinspection PhpIncludeInspection */
        $application = require $this->bootstrapFile;
        if (!$application instanceof Injectable) {
            throw new ModuleException(__CLASS__, 'Bootstrap must return \Phalcon\Di\Injectable object');
        }

        $this->di = $application->getDI();

        Di::reset();
        Di::setDefault($this->di);

        if ($this->di->has('session')) {
            // Destroy existing sessions of previous tests
            $this->di['session'] = $this->di->get($this->config['session']);
        }

        if ($this->di->has('cookies')) {
            $this->di['cookies']->useEncryption(false);
        }

        if ($this->config['cleanup'] && $this->di->has('db')) {
            if ($this->config['savepoints']) {
                $this->di['db']->setNestedTransactionsWithSavepoints(true);
            }
            $this->di['db']->begin();
            $this->debugSection('Database', 'Transaction started');
        }

        // localize
        $bootstrap = $this->bootstrapFile;
        $this->client->setApplication(function () use ($bootstrap) {
            $currentDi = Di::getDefault();
            /** @noinspection PhpIncludeInspection */
            $application = require $bootstrap;
            $di = $application->getDI();
            if ($currentDi->has('db')) {
                $di['db'] = $currentDi['db'];
            }
            if ($currentDi->has('session')) {
                $di['session'] = $currentDi['session'];
            }
            if ($di->has('cookies')) {
                $di['cookies']->useEncryption(false);
            }
            return $application;
        });
    }
1083983
public static function setCurrentModule(string $module): void
    {
        if (static::$currentModule !== null) {
            $currentModule = static::$currentModule;
            throw new ApplicationException("Current module was already set to {$currentModule}; once current module is set, you can't change it");
        }

        static::$currentModule = $module;

        // register current module & run init.php if present
        static::registerModule($module);
    }
709613
public function run(ContainerInterface $container): void
    {
        foreach ($this->getSeeds($container) as $seederClass) {
            $this->getIO()->writeInfo("Starting seed for `$seederClass`..." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE);
            $this->executeSeedInit($container, $seederClass);
            /** @var SeedInterface $seeder */
            $seeder = new $seederClass();
            $seeder->init($container)->run();
            $this->getIO()->writeInfo("Seed finished for `$seederClass`." . PHP_EOL, IoInterface::VERBOSITY_NORMAL);
        }
    }
489901
public function run($module)
    {
        $moduleSettings = $module->getInfo('settings');
        $isTheme = $this->isTheme($module->getId());
        if (!$isTheme || ($isTheme && is_array($moduleSettings))) {
            $this->addModuleSettings($moduleSettings, $module->getId());
        }
    }
1024683
public function addModule(Module $module)
    {
        $name = $module->getName();
        if (isset($this->modules[$name])) {
            throw new \LogicException(sprintf('Trying to register two modules with the same name "%s"', $name));
        }
        $this->view->addTemplatePath($module->getPath() . '/Resources/views');
        $this->modules[$name] = $module;
        
        return $this;
    }
1212522
private function loadModule(array $data)
    {
        $module = null;
        try {
            $module = $this->createFromArray($data);
        } catch (\common_exception_InconsistentData $dataException) {
            \common_Logger::w('Got inconsistent module data, skipping.');
        }
        return $module;
    }
1064864
public function setModule($module)
    {
        if (!is_string($module)) {
            throw new \InvalidArgumentException('The attribute module on the class Entity has to be string (' . gettype($module) . ('object' === gettype($module) ? ' ' . get_class($module) : '') . ' given).');
        }

        $this->module = $module;

        return $this;
    }
453264
public function setModule($name, $module, $parameters = null)
    {
        $name = strtolower($name);

        if (class_exists($module, true)) {

            /**
             * instantiation and initialization of
             * each module, return true on success
             * and false on error
             */
            $instance = new $module($parameters);
            $this->registerModule($name, $instance);
        }
        return $this;
    }
1169767
private function setByTypeFile(string $module, array $fields) : void
    {
        foreach ($fields as $field) {
            $this->setByTypeFileField($field);
        }
    }
364965
private function setByTypeModule(string $module, array $fields) : void
    {
        foreach ($fields as $field) {
            $this->setByTypeModuleField($module, $field);
        }
    }
177314
public function then(Module $module)
    {
        $this->current_state = $module->process($this->current_state);

        return $this;
    }
671490
public static function save($value, $data, AbstractModule $mod = null){
	    self::getInstance()->saveI($value, $data, $mod);
	}