Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-6542

Product Catalog: Selection Attribute not Validated via PAPI

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 4.5.5
    • 4.5.2
    • Content
    • [4.6] - Sprint 15

    Description

      1. Create a new attribute.
      2. Create a new selection attribute test_attribute with the following options:
      3. Create a new product type with identifier test_product and add the test_attribute attribute to it.
      4. Call the controller from the code example below.
      5. Go to the product created by the controller and checkout its attribute value.

        The value is test, which is not a valid value, see attribute definition from above.
      6. When editing the product, the attribute selection is empty:
      <?php
      
      declare(strict_types=1);
      
      namespace App\Controller;
      
      use Ibexa\Contracts\ProductCatalog\Local\LocalProductServiceInterface;
      use Ibexa\Contracts\ProductCatalog\ProductTypeServiceInterface;
      use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
      use Symfony\Component\Routing\Annotation\Route;
      
      final class TestController extends AbstractController
      {
          public function __construct(
              private readonly LocalProductServiceInterface $productService,
              private readonly ProductTypeServiceInterface $productTypeService,
          ) {}
      
          #[Route('/test')]
          public function test(): never
          {
              $productCreateStruct = $this->productService->newProductCreateStruct(
                  $this->productTypeService->getProductType('test_product'),
                  'eng-GB',
              );
      
              $productCreateStruct->setCode('test');
      
              $productCreateStruct->setField(
                  'name',
                  'Test',
              );
      
              $productCreateStruct->setAttribute(
                  'test_attribute',
                  'test',
              );
      
              dd($this->productService->createProduct($productCreateStruct));
          }
      }
       

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              e4ce5fdc-6f92-47ea-b579-12c992989e8c@accounts.ibexa.co Matthias Schmidt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: