PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, May 17, 2022

[FIXED] How to create a full text index with PHP attributes and Symfony 6?

 May 17, 2022     annotations, attributes, orm, php, symfony     No comments   

Issue

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

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.



Answered By - Zer0NimO
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing