Please forgive me, I am fairly new to programming.
Basically, I am trying to run a SQL statement without making it susceptible to SQL Injections
I tried running my code but it is having issues here:
$manager = this->getDoctrine()->getManager();
$builder = $manager->getRepository('AppBundle:User')->createQueryBuilder('u');
$builder->select('*')
->from('home_users', 'u')
->where(u.username LIKE :pattern');
$query = $builders->getQuery();
$query->setParameter('pattern', "%pattern%");
$users = $query->getResult();
I am trying to use the Doctrine QueryBuilder in this guideline: https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/query-builder.html
Any help will be much appreciated