Symfony 5.1 $userRepository->findall() gives inconsistent results

  findall, php, symfony

In my UserController,
gives the correct result in public function index(UserRepository $userRepository),
but using identical code in
public function search(UserRepository $userRepository) results in an SQL error:

An exception occurred while executing 'SELECT AS id_1, AS email_2, t0.roles AS roles_3, t0.password AS password_4, t0.first_name AS first_name_5, t0.last_name AS last_name_6, t0.notes AS notes_7, t0.user_name AS user_name_8 FROM person t0 WHERE = ?' with params ["search"]: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type integer: "search"

Source: Symfony Questions