Jump to content

Attempted to call an undefined method named "getLegacyAdminLink" error


Recommended Posts

Bonjour à tous, j'ai parcouru le net à la recherche d'une solution mais je n'ai rien trouvé, j'ai donc décider de poster ici :

Je viens juste de mettre à jours prestashop depuis la version 1.7.4.2 vers la version 1.7.6.4.  Depuis, je ne peux plus accéder à mes ficher produits ou crée un nouveau produit.

J'ai vérifié la page en mode debug et voici ce que j'ai reçu :


"Attempted to call an undefined method named "getLegacyAdminLink" of class "Link".
Did you mean to call "getAdminLink"?"

EXCEPTION :

Symfony\Component\Debug\Exception\ UndefinedMethodException
in src/Adapter/LegacyContext.php (line 124)

         *
         * @return string
         */
        public function getLegacyAdminLink($controller, $withToken = true, $extraParams = array())
        {
            return $this->getContext()->link->getLegacyAdminLink($controller, $withToken, $extraParams, $extraParams);
        }
        /**
         * Returns the controller link in its legacy form, without trying to convert it in symfony url.
         *

LegacyContext->getLegacyAdminLink('AdminProducts', true, array('ajax' => 1, 'action' => 'productsList', 'forceJson' => 1, 'excludeVirtuals' => 1, 'limit' => 20)) in src/PrestaShopBundle/Form/Admin/Product/ProductInformation.php (line 146)
ProductInformation->buildForm(object(FormBuilder), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'required' => true, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'inherit_data' => false, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'allow_file_upload' => false, 'error_mapping' => array(), 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => object(CsrfTokenManager), 'csrf_token_id' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => object(Closure), 'error_bubbling' => true, 'label_attr' => array(), 'upload_max_size_message' => object(Closure), 'validation_groups' => null, 'constraints' => array(), 'help' => null)) in vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php (line 126)
ResolvedFormType->buildForm(object(FormBuilder), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'required' => true, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'inherit_data' => false, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'allow_file_upload' => false, 'error_mapping' => array(), 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => object(CsrfTokenManager), 'csrf_token_id' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => object(Closure), 'error_bubbling' => true, 'label_attr' => array(), 'upload_max_size_message' => object(Closure), 'validation_groups' => null, 'constraints' => array(), 'help' => null)) in vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php (line 95)

        /**
         * {@inheritdoc}
         */
        public function buildForm(FormBuilderInterface $builder, array $options)
        {
            $this->proxiedType->buildForm($builder, $options);
        }
        /**
         * {@inheritdoc}
         */

ResolvedTypeDataCollectorProxy->buildForm(object(FormBuilder), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'required' => true, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'inherit_data' => false, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'allow_file_upload' => false, 'error_mapping' => array(), 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => object(CsrfTokenManager), 'csrf_token_id' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => object(Closure), 'error_bubbling' => true, 'label_attr' => array(), 'upload_max_size_message' => object(Closure), 'validation_groups' => null, 'constraints' => array(), 'help' => null)) in vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php (line 80)

            $builder = $type->createBuilder($this, $name, $options);
            // Explicitly call buildForm() in order to be able to override either
            // createBuilder() or buildForm() in the resolved form type
            $type->buildForm($builder, $builder->getOptions());
            return $builder;
        }
        /**

FormFactory->createNamedBuilder('step1', object(ResolvedTypeDataCollectorProxy), null, array()) in vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php (line 101)

            if (null === $type && null === $this->getDataClass()) {
                $type = 'Symfony\Component\Form\Extension\Core\Type\TextType';
            }
            if (null !== $type) {
                return $this->getFormFactory()->createNamedBuilder($name, $type, null, $options);
            }
            return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options);
        }

FormBuilder->create('step1', 'PrestaShopBundle\\Form\\Admin\\Product\\ProductInformation', array()) in vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php (line 255)

         * Converts all unresolved children into {@link FormBuilder} instances.
         */
        private function resolveChildren()
        {
            foreach ($this->unresolvedChildren as $name => $info) {
                $this->children[$name] = $this->create($name, $info[0], $info[1]);
            }
            $this->unresolvedChildren = [];
        }
    }

FormBuilder->resolveChildren() in vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php (line 202)

        {
            if ($this->locked) {
                throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
            }
            $this->resolveChildren();
            $form = new Form($this->getFormConfig());
            foreach ($this->children as $child) {
                // Automatic initialization is only supported on root forms

FormBuilder->getForm() in src/PrestaShopBundle/Controller/Admin/ProductController.php (line 700)

                        ProductCombination::class
                    );
                }
            }
            return $formBuilder->getForm();
        }
        /**
         * Do bulk action on a list of Products. Used with the 'selection action' dropdown menu on the Catalog page.
         *

ProductController->createProductForm(object(Product), object(AdminModelAdapter)) in src/PrestaShopBundle/Controller/Admin/ProductController.php (line 447)

            $isMultiShopContext = count($shopContext->getContextListShopID()) > 1;
            $modelMapper = $this->get('prestashop.adapter.admin.model.product');
            $adminProductWrapper = $this->get('prestashop.adapter.admin.wrapper.product');
            $form = $this->createProductForm($product, $modelMapper);
            $formBulkCombinations = $this->createForm(
                ProductCombinationBulk::class,
                null,
                [

ProductController->formAction('330', object(Request)) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151)

            $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS, $event);
            $controller = $event->getController();
            $arguments = $event->getArguments();
            // call controller
            $response = \call_user_func_array($controller, $arguments);
            // view
            if (!$response instanceof Response) {
                $event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
                $this->dispatcher->dispatch(KernelEvents::VIEW, $event);

HttpKernel->handleRaw(object(Request), 1) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 68)

        public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
        {
            $request->headers->set('X-Php-Ob-Level', ob_get_level());
            try {
                return $this->handleRaw($request, $type);
            } catch (\Exception $e) {
                if ($e instanceof RequestExceptionInterface) {
                    $e = new BadRequestHttpException($e->getMessage(), $e);
                }
                if (false === $catch) {

HttpKernel->handle(object(Request), 1, false) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php (line 200)

            $this->boot();
            ++$this->requestStackSize;
            $this->resetServices = true;
            try {
                return $this->getHttpKernel()->handle($request, $type, $catch);
            } finally {
                --$this->requestStackSize;
            }
        }

Kernel->handle(object(Request), 1, false) in admin242mkk2nb/index.php (line 86)

    $request = Request::createFromGlobals();
    Request::setTrustedProxies([], Request::HEADER_X_FORWARDED_ALL);
    try {
        require_once __DIR__.'/../autoload.php';
        $response = $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, false);
        $response->send();
        $kernel->terminate($request, $response);
    } catch (NotFoundHttpException $exception) {
        define('ADMIN_LEGACY_CONTEXT', true);
        // correct Apache charset (except if it's too late)

STACK TRACE

Symfony\Component\Debug\Exception\UndefinedMethodException: Attempted to call an undefined method named "getLegacyAdminLink" of class "Link". Did you mean to call "getAdminLink"? at src/Adapter/LegacyContext.php:124 at PrestaShop\PrestaShop\Adapter\LegacyContext->getLegacyAdminLink('AdminProducts', true, array('ajax' => 1, 'action' => 'productsList', 'forceJson' => 1, 'excludeVirtuals' => 1, 'limit' => 20)) (src/PrestaShopBundle/Form/Admin/Product/ProductInformation.php:146) at PrestaShopBundle\Form\Admin\Product\ProductInformation->buildForm(object(FormBuilder), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'required' => true, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'inherit_data' => false, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'allow_file_upload' => false, 'error_mapping' => array(), 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => object(CsrfTokenManager), 'csrf_token_id' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => object(Closure), 'error_bubbling' => true, 'label_attr' => array(), 'upload_max_size_message' => object(Closure), 'validation_groups' => null, 'constraints' => array(), 'help' => null)) (vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php:126) at Symfony\Component\Form\ResolvedFormType->buildForm(object(FormBuilder), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'required' => true, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'inherit_data' => false, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'allow_file_upload' => false, 'error_mapping' => array(), 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => object(CsrfTokenManager), 'csrf_token_id' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => object(Closure), 'error_bubbling' => true, 'label_attr' => array(), 'upload_max_size_message' => object(Closure), 'validation_groups' => null, 'constraints' => array(), 'help' => null)) (vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php:95) at Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeDataCollectorProxy->buildForm(object(FormBuilder), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'required' => true, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'inherit_data' => false, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'allow_file_upload' => false, 'error_mapping' => array(), 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => object(CsrfTokenManager), 'csrf_token_id' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => object(Closure), 'error_bubbling' => true, 'label_attr' => array(), 'upload_max_size_message' => object(Closure), 'validation_groups' => null, 'constraints' => array(), 'help' => null)) (vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php:80) at Symfony\Component\Form\FormFactory->createNamedBuilder('step1', object(ResolvedTypeDataCollectorProxy), null, array()) (vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:101) at Symfony\Component\Form\FormBuilder->create('step1', 'PrestaShopBundle\\Form\\Admin\\Product\\ProductInformation', array()) (vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:255) at Symfony\Component\Form\FormBuilder->resolveChildren() (vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:202) at Symfony\Component\Form\FormBuilder->getForm() (src/PrestaShopBundle/Controller/Admin/ProductController.php:700) at PrestaShopBundle\Controller\Admin\ProductController->createProductForm(object(Product), object(AdminModelAdapter)) (src/PrestaShopBundle/Controller/Admin/ProductController.php:447) at PrestaShopBundle\Controller\Admin\ProductController->formAction('330', object(Request)) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, false) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200) at Symfony\Component\HttpKernel\Kernel->handle(object(Request), 1, false) (admin242mkk2nb/index.php:86)

MERCI POUR VOTRE AIDE !

Capture d’écran 2020-04-10 à 06.58.26.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...