Follow the following steps to add JSON field in entity
Make sure your project should have add symfony MakerBundle bundle install
composer require --dev symfony/maker-bundledev option while install maker bundle, As we only need maker commands for development purpose
Console command to see all possible maker commands
php bin/console list makeThis command will show you all maker command list. See following screen shot for more details
Add JSON field in entity
php bin/console make:entityAfter enter command, mention while entity you want to edit or create, follow the steps as per following image
After success you can see JSON field added to your Product.php class
Update database schema
php bin/console doctrine:schema:update --force
Product Class code
#[ORM\Column(nullable: true)]
private ?array $tags = null;
public function setTags(?array $tags): static
{
$this->tags = $tags;
return $this;
}
Congratulation you added JSON field in your entity


Comments
Post a Comment