src/EventListener/PropertyOptionsListener.php
public function getSourceColumnNames(GetPropertyOptionsEvent $event)
    {
        if (($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_attribute')
            || ($event->getPropertyName() !== 'select_srcsorting')
        ) {
            return;
        }

        $model         = $event->getModel();
        $table         = $model->getProperty('tag_srctable');
        $schemaManager = $this->connection->getSchemaManager();

        if (!$table || !$schemaManager->tablesExist([$table])) {
            return;
        }

        $result = [];

        foreach ($schemaManager->listTableColumns($table) as $column) {
            $result[$column->getName()] = $column->getName();
        }

        $event->setOptions($result);
    }
public function getSourceColumnNames(GetPropertyOptionsEvent $event)
    {
        if (($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_attribute')
            || ($event->getPropertyName() !== 'select_srcsorting')
        ) {
            return;
        }

        $model         = $event->getModel();
        $table         = $model->getProperty('tag_srctable');
        $schemaManager = $this->connection->getSchemaManager();

        if (!$table || !$schemaManager->tablesExist([$table])) {
            return;
        }

        $result = [];

        foreach ($schemaManager->listTableColumns($table) as $column) {
            $result[$column->getName()] = $column->getName();
        }

        $event->setOptions($result);
    }
public function getSourceColumnNames ( GetPropertyOptionsEvent $ event ) { if ( ( $ event -> getEnvironment ( ) -> getDataDefinition ( ) -> getName ( ) !== 'tl_metamodel_attribute' ) || ( $ event -> getPropertyName ( ) !== 'select_srcsorting' ) ) { return ; } $ model = $ event -> getModel ( ) ; $ table = $ model -> getProperty ( 'tag_srctable' ) ; $ schemaManager = $ this -> connection -> getSchemaManager ( ) ; if ( ! $ table || ! $ schemaManager -> tablesExist ( [ $ table ] ) ) { return ; } $ result = [ ] ; foreach ( $ schemaManager -> listTableColumns ( $ table ) as $ column ) { $ result [ $ column -> getName ( ) ] = $ column -> getName ( ) ; } $ event -> setOptions ( $ result ) ; }
Retrieve all column names of type int for the current selected table.

@param GetPropertyOptionsEvent $event The event.

@return void
Retrieve all column names of type int for the current selected table .