Call to a member function getName() on null on propel:sql:build


#1

I can drop and create database just fine, but when I try to run propel:sql:build this is what I’m getting:
#0 /data/shop/development/current/vendor/propel/propel/src/Propel/Generator/Platform/DefaultPlatform.php(565): Propel\Generator\Platform\DefaultPlatform->getColumnListDDL(Array)
#1 /data/shop/development/current/vendor/propel/propel/src/Propel/Generator/Platform/DefaultPlatform.php(543): Propel\Generator\Platform\DefaultPlatform->getAddIndexDDL(Object(Propel\Generator\Model\Index))
#2 /data/shop/development/current/vendor/propel/propel/src/Propel/Generator/Platform/PgsqlPlatform.php(229): Propel\Generator\Platform\DefaultPlatform->getAddIndicesDDL(Object(Propel\Generator\Model\Table))
#3 /data/shop/development/current/vendor/propel/propel/src/Propel/Generator/Manager/SqlManager.php(108): Propel\Generator\Platform\PgsqlPlatform->getAddTablesDDL(Object(Propel\Generator\Model\Database))
#4 /data/shop/development/current/vendor/propel/propel/src/Propel/Generator/Command/SqlBuildCommand.php(112): Propel\Generator\Manager\SqlManager->buildSql()
#5 /data/shop/development/current/vendor/symfony/console/Command/Command.php(255): Propel\Generator\Command\SqlBuildCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /data/shop/development/current/vendor/symfony/console/Application.php(953): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /data/shop/development/current/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Propel\Generator\Command\SqlBuildCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /data/shop/development/current/vendor/propel/propel/src/Propel/Generator/Application.php(17): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /data/shop/development/current/vendor/symfony/console/Application.php(148): Propel\Generator\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /data/shop/development/current/vendor/propel/propel/bin/propel.php(30): Symfony\Component\Console\Application->run()
#11 /data/shop/development/current/vendor/propel/propel/bin/propel(4): require(’/data/shop/deve…’)
#12 {main}

It seems to fail on spy_product_customer_permission which in src/Orm/Propel/DE/Schema/spy_product_customer_permission.schema.xml contains the following:
<?xml version=“1.0”?>
<database xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” name=“zed” xsi:noNamespaceSchemaLocation=“http://static.spryker.com/schema-01.xsd” namespace=“Orm\Zed\ProductCustomerPermission\Persistence” package=“src.Orm.Zed.ProductCustomerPermission.Persistence”>
<table name=“spy_product_customer_permission”>
<index name=“index-spy_product_customer_permission-fk_customer”>
<index-column name=“fk_customer”/>
</index>
<index name=“index-spy_product_customer_permission-fk_product_abstract”>
<index-column name=“fk_product_abstract”/>
</index>
</table>
</database>


#2

just additional note:
if I change \Propel\Generator\Platform\DefaultPlatform::getColumnListDDL to:
public function getColumnListDDL($columns, $delimiter = ‘,’)
{
$list = [];

    if(!empty(array_filter($columns)) && $columns) {
        foreach ($columns as $column) {
            $columnName = $column->getName();
            $list[] = $this->quoteIdentifier($columnName);
        }
    }

    return implode($delimiter, $list);
}

I end up with:
Executing migration PropelMigration_1543852250 up

In MigrationMigrateCommand.php line 150:

Failed to execute SQL “CREATE INDEX “index-spy_product_customer_perm
ission-fk_customer” ON “spy_product_customer_permission” ()”. Aborting migr
ation.

In PdoConnection.php line 117:

SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near “)”
LINE 1: …mission-fk_customer" ON “spy_product_customer_permission” ()


#3

Good morning,

For me this looks like leftovers from some modules experiments.
Please delete all files from src/Orm/Propel/DE/Schema/ and rerun propel:install.
If still reproduced, please send us your composer.json/lock files for investigation.

Thanks