api/MarkLogic/MLPHP/PathRangeConstraint.php
public function getAsElem($dom)
    {
        $constElem = $dom->createElement('constraint');
        $constElem->setAttribute('name', $this->name);
        $prangeElem = $dom->createElement('range');
        $prangeElem->setAttribute('type', $this->datatype);
        $prangeElem->setAttribute('facet', $this->facet);
        if ($this->datatype === 'string') {
            $prangeElem->setAttribute('collation', 'http://marklogic.com/collation/');
        }
        $pathElem = $dom->createElement('path-index');
        $pathElem->appendChild(new \DOMText($this->path));
        $prangeElem->appendChild($pathElem);
        $this->addFacetOptions($dom, $prangeElem);
        $this->addFragmentScope($dom, $prangeElem);
        $constElem->appendChild($prangeElem);
        /* <constraint name="year">
             <range type="xs:gYear" facet="true">
               <path-index xmlns:my="http://example.com">
                 /publication/my:meta/my:year
               </path-index>
               <!--uses same options structure, options as element,
                   element-attribute or field based range constraints -->
             </range>
           </constraint> */
        return $constElem;
    }
public function getAsElem($dom)
    {
        $constElem = $dom->createElement('constraint');
        $constElem->setAttribute('name', $this->name);
        $prangeElem = $dom->createElement('range');
        $prangeElem->setAttribute('type', $this->datatype);
        $prangeElem->setAttribute('facet', $this->facet);
        if ($this->datatype === 'string') {
            $prangeElem->setAttribute('collation', 'http://marklogic.com/collation/');
        }
        $pathElem = $dom->createElement('path-index');
        $pathElem->appendChild(new \DOMText($this->path));
        $prangeElem->appendChild($pathElem);
        $this->addFacetOptions($dom, $prangeElem);
        $this->addFragmentScope($dom, $prangeElem);
        $constElem->appendChild($prangeElem);
        /* <constraint name="year">
             <range type="xs:gYear" facet="true">
               <path-index xmlns:my="http://example.com">
                 /publication/my:meta/my:year
               </path-index>
               <!--uses same options structure, options as element,
                   element-attribute or field based range constraints -->
             </range>
           </constraint> */
        return $constElem;
    }
Get the constraint as a DOMElement object.

@param DOMDocument $dom The DOMDocument object with which to create the element.