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

        $model = $event->getModel();
        $table = $model->getProperty('select_srctable');

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

        $result = [];

        $indexes = $this->connection->getSchemaManager()->listTableIndexes($table);
        foreach ($this->connection->getSchemaManager()->listTableColumns($table) as $column) {
            if (\array_key_exists($column->getName(), $indexes)) {
                continue;
            }
            $colName = $column->getName();

            $result[$colName] = $colName;
        }

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

        $model = $event->getModel();
        $table = $model->getProperty('select_srctable');

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

        $result = [];

        $indexes = $this->connection->getSchemaManager()->listTableIndexes($table);
        foreach ($this->connection->getSchemaManager()->listTableColumns($table) as $column) {
            if (\array_key_exists($column->getName(), $indexes)) {
                continue;
            }
            $colName = $column->getName();

            $result[$colName] = $colName;
        }

        $event->setOptions($result);
    }
public function getSourceColumnNames ( GetPropertyOptionsEvent $ event ) { if ( ( $ event -> getPropertyName ( ) !== 'tag_srcsorting' ) || ( $ event -> getEnvironment ( ) -> getDataDefinition ( ) -> getName ( ) !== 'tl_metamodel_attribute' ) ) { return ; } $ model = $ event -> getModel ( ) ; $ table = $ model -> getProperty ( 'select_srctable' ) ; if ( ! $ table || ! $ this -> connection -> getSchemaManager ( ) -> tablesExist ( [ $ table ] ) ) { return ; } $ result = [ ] ; $ indexes = $ this -> connection -> getSchemaManager ( ) -> listTableIndexes ( $ table ) ; foreach ( $ this -> connection -> getSchemaManager ( ) -> listTableColumns ( $ table ) as $ column ) { if ( \ array_key_exists ( $ column -> getName ( ) , $ indexes ) ) { continue ; } $ colName = $ column -> getName ( ) ; $ result [ $ colName ] = $ colName ; } $ 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 .