admin管理员组

文章数量:1125111

When deploying to Docker, routes work fine but when I deploy to gcloud App Engine, clicking on the submit button returns to /search (the search bar route), anybody knows why?

<div class="search-bar">
    {{ form_start(form, {'method': 'POST', 'action': path('app_search')}) }}
    <div class="search-bar-inner">
        [...]
        <div class="form-field form-field-localisation">
            <div class="select-wrapper select-ajax select-wrapper-icon">
                <i class="icon icon-text-2 icon-35">
                    {% include "svg.twig/icon-locate.svg.twig" %}
                </i>
                {{ form_widget(form.location) }}
            </div>
        </div>
        <div class="form-field form-field-radius">
            <div class="select-wrapper">
                {{ form_widget(form.radius) }}
            </div>
        </div>
        {{ form_rest(form) }}
        <input type="submit" class="btn btn-site-1" value="trouver">
    </div>
    {{ form_end(form) }}
</div>

SearchBar Controller:

    /** 
     * @param Request $request
     * @param ActivitySectorHandler $activitySectorHandler
     * @return RedirectResponse|Response
     */
    #[Route(path: 'search', name: 'app_search')]
    public function search(Request $request, ActivitySectorHandler $activitySectorHandler ): RedirectResponse|Response
    {
        /** @var Session $session */
        $session = $request->getSession();
        $sessionJob = $session->get('sessionJob');
        $sessionLocation = $session->get('sessionLocation');
        $sessionRadius = $session->get('sessionRadius');
        $activitySector = $activitySectorHandler->getActivitySector();

        /** @var Activity $activities */
        $activities = $this->entityManager->getRepository(Activity::class)
            ->findByActivitySector($activitySector);

        /** @var Form $form */
        $form = $this->createForm(SearchType::class, null, [
            'sessionJob' => $sessionJob,
            'sessionLocation' => $sessionLocation,
            'sessionRadius' => $sessionRadius,
            'activitySector' => $activitySector,
        ]);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $data = $form->getData();
            $session->set('sessionLocation', $data['location']);
            $session->set('sessionRadius', $data['radius']);

            $activitySectorSlug = $session->get('activitySectorSlug');

            return $this->redirectToRoute('app_search_offer_result', [
                'activitySectorSlug' => $activitySectorSlug,
                'job' => $data['job'],
                'city' => json_decode((string) $data['location'], true)['city'],
                'pageNumber' => 1,
            ]);
        }

        return $this->render("search/searchBar.html.twig", [
            'form' => $form,
            'activities' => $activities,
            'activitySector' => $activitySector,
        ]);
    }

No js, no css is loaded I'm having trouble debugging App Engine

I checked routes in local prod and dev env, docker prod and dev env, submit button redirects correctly to app_search_offer_result

本文标签: Why is App Engine not reading Symfony routesStack Overflow