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

publicAPI : Not possible to publish object containing xmltext field type if that xmltext fieldtype is "required"

    XMLWordPrintable

Details

    Description

      If you have a xmltext field type and have '$fieldAttr->isRequired = true;' it is not possible to create a object if that field type

      I have tried to set the value in 3 different ways

      $content->setField( 'xmltext', '<?xml version="1.0" encoding="utf-8"?>
      <section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">This is a object test</paragraph></section>' );
      $xmlDoc = new DOMDocument();
      $xmlDoc->loadXML( '<?xml version="1.0" encoding="utf-8"?>
      <section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">This is a object test</paragraph></section>' );
      $xmlValue = new eZ\Publish\Core\FieldType\XmlText\Value( $xmlDoc );
      $content->setField( 'xmltext', $xmlValue );
      
      $xmlInputConverter = new eZ\Publish\Core\FieldType\XmlText\Converter\Input\EzXml( "../vendor/ezsystems/ezpublish/eZ/Bundle/EzPublishCoreBundle/Resources/schemas/ezxml.xsd" );
      
      $content->setField( 'xmltext', $xmlInputConverter->convert( '<?xml version="1.0" encoding="utf-8"?>
      <section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">This is a object test</paragraph></section>' ) );
      

      All 3 methods gives exception once I try to publish object with saveContent():

      1) eZPublishAPIXMLText::testTC1305CreateXMLTextObject
      eZ\Publish\Core\Base\Exceptions\ContentValidationException: Required field 'xmltext' value is empty
      
      /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish/eZ/Publish/Core/Repository/ContentService.php:542
      /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish/eZ/Publish/Core/SignalSlot/ContentService.php:237
      /var/www/apache2php53/ezpublish5/ezpublish_testsystem/extension/ezpublishapitests/classes/ezpublishapitesthelper.php:417
      /var/www/apache2php53/ezpublish5/ezpublish_testsystem/extension/ezpublishapitests/tests/ezpublishapi/ezpublishapi/datatypes/xmlblock/ezpublishapixmlblock.php:135
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            vidar.langseid@ibexa.co Vidar Langseid
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: