Symfony 4 – Add new Column to existing Repository

How to add new Attribute/Column to existing Table/Repository using BundleMaker

Make sure you have the “The Symfony MakerBundle”

composer require symfony/maker-bundle --dev

Add the attribute to your Entity File

Simply add the new attribute to your entity file, i.e. App\Entity\Posts.php

* @ORM\Column(type="string", length=255)
private $excerpt;

Regenerate using the make command

php bin/console make:entity --regenerate

Generate the migration file

php bin/console doctrine:migrations:diff


php bin/console doctrine:migrations:migrate