'How to create a full text index with PHP attributes and Symfony 6?

I need to create a search input inside my symfony 6.0 project. I'm using PHP 8.1.5

In the old days i used the following syntax with annotations :

/**
 * @ORM\Table(name="category", indexes={@ORM\Index(columns={"name", "description"}, flags={"fulltext"})})
 */
class Category
{

But right now i'm not able to find the good way to do it using attributes. I tried the following :

#[ORM\Index(name: 'category_idx', columns: ['name', 'description'])] 

but the migration didn't create a full text index.

Could you please tell me how you did it if you already had this situation ?



Solution 1:[1]

For those who are looking for the same answer here it is.

#[ORM\Index(name: 'category_idx', columns: ['name', 'description'], flags: ['fulltext'])]

This will indeed create a TABLE with a fulltext index.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zer0NimO