{@inheritDoc}

@return Seeder
327672
public function resolve($class)
    {
        if ($this->getContainer()->has($class)) {
            $seeder = $this->getContainer()->get($class);
        } else {
            $seeder = new $class;
        }

        if (!$seeder instanceof self) {
            throw new \LogicException(sprintf('The seeder "%s" does not extend WouterJ\EloquentBundle\Seeder', get_class($seeder)));
        }
        $seeder->setSfContainer($this->getContainer());

        $this->addSeededClass($seeder);

        return $seeder;
    }
773734
protected function buildFinder()
    {
        $finder = new Finder();
        $finder->files()
            ->name('/(\.php|composer\.json)$/')
            ->in($this->path)
            ->exclude($this->excludeDirs);

        return $finder;
    }
190508
protected function createGenerator()
    {
        $filesystem = $this->getContainer()->get('filesystem');
        $registry = $this->getContainer()->get('doctrine');

        return new DefaultSiteGenerator($filesystem, $registry, '/defaultsite', $this->assistant, $this->getContainer());
    }
948085
public function create($data)
    {
        $descriptor = new SeeDescriptor($data->getName());
        $descriptor->setDescription($data->getDescription());

        $reference = $data->getReference();

        if (substr($reference, 0, 7) !== 'http://'
            && substr($reference, 0, 8) !== 'https://'
            && $reference !== 'self'
            && $reference !== '$this'
        ) {
            // TODO: move this to the ReflectionDocBlock component
            // Expand FQCN part of the FQSEN
            $referenceParts = explode('::', $reference);
            if (count($referenceParts) > 1 && $reference[0] != '\\') {
                $type = current($referenceParts);
                $type = new Collection(
                    array($type),
                    $data->getDocBlock() ? $data->getDocBlock()->getContext() : null
                );
                $referenceParts[0] = $type;
            } elseif (isset($reference[0]) && $reference[0] != '\\') {
                array_unshift($referenceParts, Linker::CONTEXT_MARKER);
            }

            $reference = implode('::', $referenceParts);
        }

        $descriptor->setReference($reference);

        return $descriptor;
    }
1308500
public function seed($environment, $seed = null)
    {
        $seeds = $this->getSeeds();

        if ($seed === null) {
            // run all seeders
            foreach ($seeds as $seeder) {
                if (array_key_exists($seeder->getName(), $seeds)) {
                    $this->executeSeed($environment, $seeder);
                }
            }
        } else {
            // run only one seeder
            if (array_key_exists($seed, $seeds)) {
                $this->executeSeed($environment, $seeds[$seed]);
            } else {
                throw new \InvalidArgumentException(sprintf('The seed class "%s" does not exist', $seed));
            }
        }
    }
1146581
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('doctrine_mongodb');
        $rootNode    = method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('doctrine_mongodb');

        $this->addDocumentManagersSection($rootNode);
        $this->addConnectionsSection($rootNode);
        $this->addResolveTargetDocumentsSection($rootNode);

        $rootNode
            ->children()
                ->scalarNode('proxy_namespace')->defaultValue('MongoDBODMProxies')->end()
                ->scalarNode('proxy_dir')->defaultValue('%kernel.cache_dir%/doctrine/odm/mongodb/Proxies')->end()
                ->scalarNode('auto_generate_proxy_classes')
                    ->defaultValue(ODMConfiguration::AUTOGENERATE_EVAL)
                    ->beforeNormalization()
                    ->always(static function ($v) {
                        if ($v === false) {
                            return ODMConfiguration::AUTOGENERATE_EVAL;
                        }

                        if ($v === true) {
                            return ODMConfiguration::AUTOGENERATE_FILE_NOT_EXISTS;
                        }

                        return $v;
                    })
                    ->end()
                ->end()
                ->scalarNode('hydrator_namespace')->defaultValue('Hydrators')->end()
                ->scalarNode('hydrator_dir')->defaultValue('%kernel.cache_dir%/doctrine/odm/mongodb/Hydrators')->end()
                ->scalarNode('auto_generate_hydrator_classes')
                    ->defaultValue(ODMConfiguration::AUTOGENERATE_NEVER)
                    ->beforeNormalization()
                    ->always(static function ($v) {
                        if ($v === false) {
                            return ODMConfiguration::AUTOGENERATE_NEVER;
                        }

                        if ($v === true) {
                            return ODMConfiguration::AUTOGENERATE_ALWAYS;
                        }

                        return $v;
                    })
                    ->end()
                ->end()
                ->scalarNode('persistent_collection_namespace')->defaultValue('PersistentCollections')->end()
                ->scalarNode('persistent_collection_dir')->defaultValue('%kernel.cache_dir%/doctrine/odm/mongodb/PersistentCollections')->end()
                ->scalarNode('auto_generate_persistent_collection_classes')->defaultValue(ODMConfiguration::AUTOGENERATE_NEVER)->end()
                ->scalarNode('fixture_loader')
                    ->defaultValue(ContainerAwareLoader::class)
                    ->beforeNormalization()
                        ->ifTrue(static function ($v) {
                            return ! ($v === ContainerAwareLoader::class || in_array(ContainerAwareLoader::class, class_parents($v)));
                        })
                        ->then(static function ($v) {
                            throw new LogicException(sprintf('The %s class is not a subclass of the ContainerAwareLoader', $v));
                        })
                    ->end()
                ->end()
                ->scalarNode('default_document_manager')->end()
                ->scalarNode('default_connection')->end()
                ->scalarNode('default_database')->defaultValue('default')->end()
                ->arrayNode('default_commit_options')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('j')->end()
                        ->integerNode('timeout')->end()
                        ->scalarNode('w')->end()
                        ->integerNode('wtimeout')->end()
                        // Deprecated options
                        ->booleanNode('fsync')->info('Deprecated. Please use the "j" option instead.')->end()
                        ->scalarNode('safe')->info('Deprecated. Please use the "w" option instead.')->end()
                    ->end()
                ->end()
            ->end();

        return $treeBuilder;
    }
160001
private function createSeeder(): void
    {
        $aFields  = $this->getArguments();
        $aCreated = [];

        try {

            $aModels = array_filter(explode(',', $aFields['MODEL_NAME']));
            sort($aModels);

            foreach ($aModels as $sModel) {

                $aFields['MODEL_NAME'] = $sModel;
                $this->oOutput->write('Creating seeder <comment>' . $sModel . '</comment>... ');

                //  Validate model exists by attempting to load it
                if (!stringToBoolean($this->oInput->getOption('skip-check'))) {
                    Factory::model($sModel, $aFields['MODEL_PROVIDER']);
                }

                //  Check for existing seeder
                $sPath = static::SEEDER_PATH . $sModel . '.php';
                if (file_exists($sPath)) {
                    throw new SeederExistsException(
                        'Seeder "' . $sModel . '" exists already at path "' . $sPath . '"'
                    );
                }

                $this->createFile($sPath, $this->getResource('template/seeder.php', $aFields));
                $aCreated[] = $sPath;
                $this->oOutput->writeln('<info>done!</info>');
            }

        } catch (\Exception $e) {
            $this->oOutput->writeln('<error>failed!</error>');
            //  Clean up created seeders
            if (!empty($aCreated)) {
                $this->oOutput->writeln('<error>Cleaning up - removing newly created files</error>');
                foreach ($aCreated as $sPath) {
                    @unlink($sPath);
                }
            }
            throw $e;
        }
    }
1295588
private function getDirectoryIterator()
    {
        $directoryIterator = new RecursiveDirectoryIterator($this->basePath);
        $directoryIterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);

        return new RecursiveIteratorIterator($directoryIterator);
    }
556318
public function addSeeder(AbstractPopulator $seeder)
    {
        $seeder->setPopulator($this);
        $seeder->setDatabase($this->database);
        $seeder->setFaker($this->faker);
        $this->seeders[] = $seeder;
    }
770379
public static function initialize()
    {
        $manager = self::$manager = new self();
        $manager->seedHandlerStack();

        session_set_save_handler($manager);

        return $manager;
    }
1299791
public function generate($seeder)
    {
        $generator = new Generator(
            $this->setting->getSeederDirectory(),
            "{$seeder}_seeder"
        );

        if ($generator->fileExists()) {
            echo "\033[0;31mThe seeder already exists.\033[00m";

            exit(1);
        }

        $num = (int)  $this->arg->options()->get('--seed', 5);

        $generator->write('seed', [
            'num' => $num,
            'name' => $seeder
        ]);

        echo "\033[0;32mThe seeder has been created.\033[00m\n";

        exit(0);
    }
608912
protected static function execute($seeder)
    {
        $data = self::fill($seeder);
        //
        $table = new DBTable($seeder->table);

        return $table->insert($data);
    }
91300
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('lsw_memcache');
        $rootNode
            ->append($this->addSessionSupportSection())
            ->append($this->addDoctrineSection())
            ->append($this->addFirewallSection())
            ->append($this->addClientsSection())
        ;

        return $treeBuilder;
    }
115407
protected function getNodeBuilder()
    {
        if (null === $this->nodeBuilder) {
            $this->nodeBuilder = new NodeBuilder();
        }

        return $this->nodeBuilder->setParent($this);
    }
931995
public static function createContainer()
    {
        $resolver = new ReferenceResolver();
        
        $builder = new ContainerBuilder($resolver, [self::$appDir]);

        foreach (self::$loaders as $loader) {
            $builder->addLoader($loader);
        }
        $builder->setApplicationRootDirectory(self::$appDir);

        $builder->addConfigFiles(self::$configFiles);

        return $builder->createContainer();
    }
301904
public function build(): DiscardSearchResultsRequest
	{
		$instance = new DiscardSearchResultsRequest();
		if ($this->searchId === null) {
			throw new BuilderException('Property [searchId] is required.');
		}
		$instance->searchId = $this->searchId;
		return $instance;
	}
530072
public function execute($seeder = null)
    {
        $container = Ioc::getContainer();

        if (is_string($seeder)) {
            $ref = new \ReflectionClass($this);

            include_once dirname($ref->getFileName()) . '/' . $seeder . '.php';

            $seeder = $container->newInstance($seeder, ['db' => $this->db, 'command' => $this->command]);
        }

        $seeder->setDb($this->db)
            ->setCommand($this->command);

        $this->command->out()->out('Import seeder <info>' . get_class($seeder) . '</info>');

        $container->call([$seeder, 'doExecute']);

        $this->command->out()->out('  <option>Import completed...</option>');

        return $this;
    }