@param string $name
@param Carbon $dateTime
@param bool   $isAlterMigration

@return string
17784
protected function getMigrationPath($name, $dateTime, $isAlterMigration = false)
    {
        $basePath = $this->getMigrationBasePath();

        $type = $isAlterMigration ? 'alter' : 'create';

        $postfix = $isAlterMigration ? '_'.$dateTime->format('YmdHis') : '';

        return $basePath.DIRECTORY_SEPARATOR.$dateTime->format('Y_m_d_His').'_'.$type.'_'.$name.'_table'.$postfix.'.php';
    }
1069493
private function getFormTime(string $name): ?DateTime
    {
        $key = $this->getSessionKey($name);

        if ($this->hasFormProtection($name)) {
            return $this->session->get($key);
        }

        return null;
    }
276474
protected function filterActionMethodName($name)
    {
        $filter = new FilterChain;
        $filter->attachByName('Zend\Filter\Word\CamelCaseToDash');
        $filter->attachByName('StringToLower');
        return rtrim(preg_replace('/action$/', '', $filter->filter($name)), '-');
    }
731571
public function create($name, $path, $migrations)
    {
        $path = $this->getPath($name, $path);

        $ups = [];

        $downs = [];

        if(isset($migrations['create'])){

            foreach($migrations['create'] as $table => $data){

                $ups[] = $this->populateStub('create', [
                    'table' => $table,
                    'columns' => $this->format($data['cols'])
                ]);

                $downs[] = $this->populateStub('drop', ['table' => $table]);
            }
        }

        if(isset($migrations['update'])){

            foreach($migrations['update'] as $table => $data){

                $ups[] = $this->populateStub('update', [
                    'table' => $table,
                    'columns' => isset($data['cols']) ? $this->format($data['cols']) : null,
                    'foreign_keys' => isset($data['fks']) ? $this->format($data['fks']) : null
                ]);

                $downs[] = $this->populateStub('down', [
                    'table' => $table,
                    'columns' => isset($data['cols']) ? $this->format($this->drop(array_keys($data['cols']), 'Column')) : null,
                    'foreign_keys' => isset($data['fks']) ? $this->format($this->drop(array_keys($data['fks']), 'Foreign')) : null
                ]);
            }
        }

        $ups = array_filter($ups, 'strlen');
        $downs = array_filter($downs, 'strlen');

        if($ups){

            $this->files->put($path, $this->populateStub('blank', [
                'class' => studly_case($name),
                'up' => $this->format($ups, ''),
                'down' => $this->format(array_reverse($downs), '')
            ]));

            return $path;
        }

        return false;
    }
552656
public function getSchemaExtension($name, ConnectionInterface $conn)
    {
        if (isset($this->extensions[$name])) {
            return call_user_func($this->extensions[$name], $conn);
        }

        return null;
    }
156160
protected function quoteNameString($name, $asSinglePart = false)
	{
		$q = $this->nameQuote . $this->nameQuote;

		// Double quote reserved keyword
		$name = str_replace($q[1], $q[1] . $q[1], $name);

		if ($asSinglePart)
		{
			return $q[0] . $name . $q[1];
		}

		return $q[0] . str_replace('.', "$q[1].$q[0]", $name) . $q[1];
	}
203737
public function getAddTimerCode($name, $delay, $replaceExisting = false) {
        $functionName = $this->getAddTimerFunctionName();
        return $functionName . '("' . $name . '", ' . $delay . ', ' . ($replaceExisting ? 'True' : 'False') . ');';
    }
1125834
public function addFilterDate($key, $name, $column = null)
	{
		$column = $column ?: $key;

		if (!is_string($column)) {
			throw new DataGridException('FilterDate can only filter in one column.');
		}

		$this->addFilterCheck($key);

		return $this->filters[$key] = new Filter\FilterDate($this, $key, $name, $column);
	}
1097862
public static function hasMigrated(string $name){
        $res = DB::connection('default')->table('migrations')->where('name', $name)->first();
        return !is_null($res);
    }
1199936
public function findByGenericFilter($name, $filter = null, $page = 1, $orderColumn = null, $orderType = null) {
        $this->load();
        $mapper = MapperBuilder::buildFromName($this->mapping, $name);

        $selectQuery = "";
        $whereQuery = "";
        $orderQuery = "";

        $selectQuery .= "SELECT * FROM `" . $mapper->getTable() . "` ";
        $filterList = array();
        if (!is_null($filter)) {
            $filterList = explode(" ", $filter);
        }

        if (!is_null($filter)) {
            $whereQuery .= " WHERE 1=2 ";
            foreach ($filterList as $searchedWord) {
                foreach ($mapper->getFilter("generic")->getColumns() as $filteredColumn) {
                    $whereQuery .= " OR $filteredColumn LIKE '%" . $searchedWord . "%'";
                }
            }
        } else {
            $whereQuery .= " WHERE 1 ";
        }

        if (!is_null($orderColumn)) {
            $orderQuery .= "ORDER BY $orderColumn ";
            if (!is_null($orderType)) {
                $orderQuery .= "$orderType";
            } else {
                $orderQuery .= "ASC";
            }
        }

        $from = ($page - 1) * $mapper->getFilter("generic")->getItemsPerPage();
        $pageQuery = " LIMIT $from , " . $mapper->getFilter("generic")->getItemsPerPage();

        $query = $selectQuery . $whereQuery . $orderQuery . $pageQuery;
        $result = $this->getDataSource()->query($query);

        if ($result) {
            $collection = new Collection($mapper->getClass(), $result, $mapper);
        } else {
            $collection = new Collection($mapper->getClass(), array(), $mapper);
        }

        $selectCountQuery = "SELECT count(*) as total FROM `" . $mapper->getTable() . "` ";
        $query = $selectCountQuery . $whereQuery;
        $result = $this->getDataSource()->query($query);
        $itemCount = $result[0]["total"];
        $pager = new Pager($collection, $itemCount, $mapper->getFilter("generic")->getItemsPerPage(), $page);

        return $pager;
    }
83680
private function writeMigration($name, $eventObjectTable, $actionTiming, $event)
    {
        $file = pathinfo($this->creator->write(
            $name,
            $eventObjectTable,
            $actionTiming,
            $event,
            $this->getMigrationPath()
        ), PATHINFO_FILENAME);

        $this->line("<info>Created Migration:</info> {$file}");
    }
381839
protected function getMigrationFile($name, $path = false)
    {
        $path = $path ? $path : $this->migrationPath;
        return $path . DIRECTORY_SEPARATOR . $name . '.php';
    }
755456
public function removeMigrationFile($name, $type)
    {
        $class_name = $this->getMigrationName($type, $name);

        $removed = false;
        $migration_file = $this->getMigrationPath().$class_name.'.php';
        if (file_exists($migration_file)) {
            if (unlink($migration_file)) {
                $removed = true;
                $migration = $this->modx->getObject($this->blend_class_object, ['name' => $class_name]);
                if (is_object($migration) && $migration->remove()) {
                    $this->out($class_name.' migration has been removed from the blend_migrations table', Blender::VERBOSITY_VERY_VERBOSE);

                }
            } else {
                $this->outError($class_name.' migration has not been removed from the blend_migrations table');
            }

        } else {
            $this->outError($this->getMigrationPath().$class_name.'.php migration could not be found to remove');
        }

        return $removed;
    }
1073427
public function isCurrentMigration($name)
    {
        $current = $this->getCurrentMigration();

        return (!is_null($current) && $current->name == $name);
    }
396706
public function getFilter($name, $need = TRUE)
    {
        return $this->hasFilters()
            ? $this->getComponent(Filter::ID)->getComponent(Helpers::formatColumnName($name), $need)
            : NULL;
    }
730948
public function apply($name, $value, $query, FilterInterface $filter)
    {
        $column = ( ! empty($this->table) ? $this->table . '.' : null)
                . ( ! empty($this->column) ? $this->column : $name);

        $operator = '=';

        if ( ! $this->exact) {
            $operator = 'LIKE';
            $value    = '%' . $value . '%';
        }

        return $query->where($column, $operator, $value);
    }
430105
public function actionCreate($name, $module = false)
    {
        if (empty($module)) {
            return parent::actionCreate($name);
        }
        
        if (!isset($this->migrationPath[$module])) {
            throw new Exception("The module \"$module\" does not exist in the application modules configuration.");
        }
        
        // apply custom migration code to generate new migrations for a module specific path
        if (!preg_match('/^[\w\\\\]+$/', $name)) {
            throw new Exception('The migration name should contain letters, digits, underscore and/or backslash characters only.');
        }
        
        $className = 'm'.gmdate('ymd_His').'_'.$name;
        
       
        $migrationPath = $this->migrationPath[$module];
        
        $file = $migrationPath . DIRECTORY_SEPARATOR . $className . '.php';
        if ($this->confirm("Create new migration '$file'?")) {
            $content = $this->generateMigrationSourceCode([
                'name' => $name,
                'className' => $className,
                'namespace' => null,
            ]);
            FileHelper::createDirectory($migrationPath);
            file_put_contents($file, $content);
            $this->stdout("New migration created successfully.\n", Console::FG_GREEN);
        }
    }