no need this changes. revert this changes. we can directly generate the path in twig template itself as i mentioned bellow.