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

'ezobjectrelation' field is not validated when using Public API

    XMLWordPrintable

Details

    • eZ Platform, Ibexa Content

    Description

      Steps to reproduce:

      1. Create new Content Type with ezstring field and ezobjectrelation field.
      2. Use Public PHP API (https://doc.ibexa.co/en/2.5/api/public_php_api_creating_content/#creating-content-item-draft) to create a draft of Content Type from step 1 with the invalid relation data, for example:
                $contentType = $this->contentTypeService->loadContentTypeByIdentifier('test');
                $contentCreateStruct = $this->contentService->newContentCreateStruct($contentType, 'eng-GB');
                $contentCreateStruct->setField('new_ezstring_1', 'test');
                $contentCreateStruct->setField('new_ezobjectrelation_2', 'testtest');
        
                $locationCreateStruct = $this->locationService->newLocationCreateStruct(2);
        
                $draft = $this->contentService->createContent($contentCreateStruct, array($locationCreateStruct));
        

      Result:
      The draft was created without any validation when it comes to ezobjectrelation fieldtype.

      Expected result:
      The exception should be thrown that validation failed, like it's done for other fieldtypes.

      Note:
      The same problem occurs for ezobjectrelationlist, the only thing which is validated is the number of items allowed to be selected.

      The fix will also validate the allowed Content Types which have been set in field type config - this should be tested as well.

      https://github.com/ezsystems/ezpublish-kernel/pull/3131#issuecomment-1061955070 -> something to keep an eye on during the QA

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              bartlomiej.wajda@ibexa.co Bartłomiej Wajda
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: