1
I have the following code in my controller:
$shares = $this
->getDoctrine()
->getRepository('AppBundle:Shares')
->findBy(
$where,
$orderBy,
$paginator->getPerPage(),
$paginator->getCursor()
)
;
Note that I have as a parameter the variable where for the method findby.
The variable where is an array:
$where['hashtags'] = "teste";
The problem is that in the entity Shares, the field hashtags is an array:
/**
* @ORM\Column(type="array")
*/
protected $hashtags;
In the database is saved as follows:
a:2:{i:0;s:5:"teste";i:1;s:9:"bubbletea";}
How do I search all the records you have in the field hashtags the tag "test" using the function findby?
Actually the idea of serializing was not the best one even more because the whole application revolves around tags, however the solution worked. I will change and add a Manytomany relation. Thanks for the help.
– Filipe Moraes