Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-26382

PAPI: Updating ContentType sets IntegerValueValidator min/max to 0

    XMLWordPrintable

    Details

      Description

      Steps to reproduce
      • Find or create a new content type with at least on integer attribute
      • Leave the values for Min integer value and Max integer value to Empty
      • Run the sample code below on a Command script, passing the class identifier as argument.
      Expected result

      Min integer value and Max integer value should both be set to empty

      Actual result

      Min integer value and Max integer value are both set to zero, meaning zero is now the only value that will validate in that field.

      Sample code:

      protected function configure()
      {
          $this->setName('ez:support:update_type')
              ->setDefinition(
                  array(
                      new InputArgument('contentType', InputArgument::REQUIRED, 'Content type to update'),
                  )
              )
              ->setDescription('Updates a content type');
      }
      
      protected function execute(InputInterface $input, OutputInterface $output)
      {
          $repository = $this->getContainer()->get('ezpublish.api.repository');
          // set admin as current user
          $user = $repository->getUserService()->loadUser( 14 );
          $repository->setCurrentUser( $user );
          /** @var \eZ\Publish\API\Repository\ContentTypeService $contentTypeService */
          $contentTypeService = $repository->getContentTypeService();
          $contentType = $contentTypeService->loadContentTypeByIdentifier(
              $input->getArgument('contentType')
          );
          $contentTypeDraft = $contentTypeService->createContentTypeDraft($contentType);
          $contentTypeUpdateStruct = $contentTypeService->newContentTypeUpdateStruct();
          $contentTypeUpdateStruct->mainLanguageCode = 'eng-GB';
          $contentTypeService->updateContentTypeDraft($contentTypeDraft, $contentTypeUpdateStruct);
          $contentTypeService->publishContentTypeDraft($contentTypeDraft);
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              joao.inacio-obsolete@ez.no Joao Inacio (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: