api/MarkLogic/MLPHP/FieldRangeConstraint.php
public function getAsElem($dom)
    {
        $constElem = $dom->createElement('constraint');
        $constElem->setAttribute('name', $this->name);
        $frangeElem = $dom->createElement('range');
        $frangeElem->setAttribute('type', $this->datatype);
        $frangeElem->setAttribute('facet', $this->facet);
        if ($this->datatype === 'xs:string') {
            $frangeElem->setAttribute('collation', 'http://marklogic.com/collation/');
        }
        $fieldElem = $dom->createElement('field');
        $fieldElem->setAttribute('name', $this->field);
        $frangeElem->appendChild($fieldElem);
        $this->addFacetOptions($dom, $frangeElem);
        $this->addFragmentScope($dom, $frangeElem);
        $constElem->appendChild($frangeElem);
        /* <constraint name='name'>
                 <range type='string' collation='http://marklogic.com/collation/'>
                    <field name='my-field-name'/>
                 </range>
            </constraint> */
        return $constElem;
    }
public function getAsElem($dom)
    {
        $constElem = $dom->createElement('constraint');
        $constElem->setAttribute('name', $this->name);
        $frangeElem = $dom->createElement('range');
        $frangeElem->setAttribute('type', $this->datatype);
        $frangeElem->setAttribute('facet', $this->facet);
        if ($this->datatype === 'xs:string') {
            $frangeElem->setAttribute('collation', 'http://marklogic.com/collation/');
        }
        $fieldElem = $dom->createElement('field');
        $fieldElem->setAttribute('name', $this->field);
        $frangeElem->appendChild($fieldElem);
        $this->addFacetOptions($dom, $frangeElem);
        $this->addFragmentScope($dom, $frangeElem);
        $constElem->appendChild($frangeElem);
        /* <constraint name='name'>
                 <range type='string' collation='http://marklogic.com/collation/'>
                    <field name='my-field-name'/>
                 </range>
            </constraint> */
        return $constElem;
    }
Get the constraint as a DOMElement object.

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