isAttributeTable example



        $this->View()->assign(['success' => true]);
    }

    public function generateModelsAction()
    {
        $table = $this->Request()->getParam('tableName');

        $mapping = $this->get(TableMappingInterface::class);

        if (!$mapping->isAttributeTable($table) || !$table) {
            $this->View()->assign(['success' => false, 'message' => 'Table not supported']);

            return;
        }

        if (!$model = $mapping->getTableModel($table)) {
            $this->View()->assign(['success' => false, 'message' => 'Table has no model']);

            return;
        }

        
$this->mapping = $mapping;
        $this->dataLoader = $dataLoader;
    }

    /** * {@inheritdoc} * * @throws Exception */
    public function persist($data$table$foreignKey)
    {
        if (!$this->mapping->isAttributeTable($table)) {
            throw new Exception(sprintf('Table %s is no attribute table', $table));
        }
        if (!$foreignKey) {
            throw new Exception('No foreign key provided');
        }
        $data = $this->filter($table$data);

        $exists = $this->dataLoader->load($table$foreignKey);

        if (!$exists) {
            $this->create($table$data$foreignKey);

            

        if (!$table) {
            throw new Exception('No table name provided');
        }
        if (!$name) {
            throw new Exception('No column name provided');
        }

        $this->validateField($table);
        $this->validateField($name);

        if (!$this->tableMapping->isAttributeTable($table)) {
            throw new Exception(sprintf('Provided table is no attribute table: %s', $table));
        }
        if ($this->tableMapping->isIdentifierColumn($table$name)) {
            throw new Exception(sprintf('Provided column is an identifier column: %s', $name));
        }

        $lowerCaseName = strtolower($name);
        if (\in_array($lowerCaseName$this->nameBlacklist)) {
            throw new Exception(sprintf('Provided name %s is a reserved keyword.', $name));
        }
    }

    
$this->connection = $connection;
        $this->mapping = $mapping;
    }

    /** * {@inheritdoc} * * @throws Exception */
    public function load($table$foreignKey)
    {
        if (!$this->mapping->isAttributeTable($table)) {
            throw new Exception(sprintf('Table %s is no attribute table', $table));
        }

        if (!$foreignKey) {
            throw new Exception('No foreign key provided');
        }

        $foreignKeyColumn = $this->mapping->getTableForeignKey($table);

        $query = $this->connection->createQueryBuilder();
        $query->select('alias.*')
            
return \in_array(strtolower($column)$names);
    }

    /** * {@inheritdoc} * * @throws Exception */
    public function getDependingTables($table)
    {
        if (!$this->isAttributeTable($table)) {
            throw new Exception(sprintf('Table %s is no supported attribute table', $table));
        }

        return $this->tables[$table]['dependingTables'];
    }

    /** * {@inheritdoc} */
    public function getTableColumns($table)
    {
        

        }

        return null;
    }

    /** * {@inheritdoc} */
    public function getList($table)
    {
        if (!$this->tableMapping->isAttributeTable($table)) {
            return [];
        }

        $columns = $this->tableMapping->getTableColumns($table);
        $configuration = $this->getTableConfiguration($table);

        $items = [];
        foreach ($columns as $column) {
            $name = strtolower($column->getName());
            $default = $column->getDefault();

            
Home | Imprint | This part of the site doesn't use cookies.