Fixed xf-dev:generate-schema-entity ignores nullable

S Thomas

Well-known member
Affected version
2.0.7
PHP:
 $structure->primaryKey = 'title';
 $structure->columns = [
            'title' => ['type' => self::STR, 'maxLength' => 250,
                'censor' => true,
            ],
            'description' => ['type' => self::STR, 'maxLength' => 250,
                'nullable' => true,
            ]
        ];
Actual result:
Code:
>php cmd.php xf-dev:generate-schema-entity Prefix:Entity

$this->schemaManager()->createTable('table', function(\XF\Db\Schema
\Create $table)
{
        $table->addColumn('title', 'varchar', 250);
        $table->addColumn('description', 'varchar', 250);
        $table->addPrimaryKey('title');
});
Expected result:
Code:
>php cmd.php xf-dev:generate-schema-entity Prefix:Entity

$this->schemaManager()->createTable('table', function(\XF\Db\Schema
\Create $table)
{
        $table->addColumn('title', 'varchar', 250);
        $table->addColumn('description', 'varchar', 250)->nullable(true);
        $table->addPrimaryKey('title');
});
 
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in the next XF release (2.0.11).

Change log:
Ensure 'nullable' entity property is reflected in generated code
 
Back
Top Bottom