Example #1
0
 /**
  * Create a FieldRangeConstraint object.
  *
  * @see http://docs.marklogic.com/search:search#opt-constraint
  *
  * @param string $name Constraint name.
  * @param string $datatype Constraint datatype.
  * @param string $facet Whether constraint should be faceted ('true' or 'false').
  * @param string $field Field name.
  */
 public function __construct($name, $datatype, $facet = 'true', $field)
 {
     $this->field = (string) $field;
     $this->datatype = (string) $datatype;
     $this->facet = (string) $facet;
     parent::__construct($name);
 }
Example #2
0
 /**
  * Create a PathRangeConstraint object.
  *
  * @see http://docs.marklogic.com/search:search#opt-constraint
  *
  * @param string $name Constraint name.
  * @param string $datatype Constraint datatype.
  * @param string $facet Whether constraint should be faceted ('true' or 'false').
  * @param string $elem Path expression (e.g., '/publication/my:meta/my:year').
  */
 public function __construct($name, $datatype, $facet = 'true', $path)
 {
     $this->path = (string) $path;
     $this->datatype = (string) $datatype;
     $this->facet = (string) $facet;
     parent::__construct($name);
 }
Example #3
0
 /**
  * Create a ValueConstraint object.
  *
  * @see http://docs.marklogic.com/search:search#opt-constraint
  *
  * @param string $name Constraint name.
  * @param string $elem Element name.
  * @param string $ns An element namespace.
  * @param string $attr Attribute name.
  * @param string $attrNs An attribute namespace.
  */
 public function __construct($name, $elem, $ns = '', $attr = '', $attrNs = '')
 {
     $this->elem = (string) $elem;
     $this->ns = (string) $ns;
     $this->attr = (string) $attr;
     $this->attrNs = (string) $attrNs;
     parent::__construct($name);
 }
Example #4
0
 /**
  * Create a RangeConstraint object.
  *
  * @see http://docs.marklogic.com/search:search#opt-constraint
  *
  * @param string $name Constraint name.
  * @param string $datatype Constraint datatype.
  * @param string $facet Whether constraint should be faceted ('true' or 'false').
  * @param string $elem Name of the element.
  * @param string $ns Element namespace.
  * @param string $attr Attribute name.
  * @param string $attrNs An attribute namespace.
  */
 public function __construct($name, $datatype, $facet = 'true', $elem, $ns = '', $attr = '', $attrNs = '')
 {
     $this->elem = (string) $elem;
     $this->ns = (string) $ns;
     $this->attr = (string) $attr;
     $this->attrNs = (string) $attrNs;
     $this->datatype = (string) $datatype;
     $this->facet = (string) $facet;
     $this->buckets = array();
     parent::__construct($name);
 }
 /**
  * Get string representation of this constraint.
  *
  * @return string
  */
 public function toString()
 {
     return vsprintf('Traversable<%s>', [$this->valueConstraint->toString()]);
 }
Example #6
0
 /**
  * Create a FieldWordConstraint object.
  *
  * @see http://docs.marklogic.com/search:search#opt-constraint
  *
  * @param string $name Constraint name.
  * @param string $field Field name.
  */
 public function __construct($name, $field)
 {
     $this->field = (string) $field;
     parent::__construct($name);
 }
 /**
  * @return array
  */
 public function getExpressionData()
 {
     $data = parent::getExpressionData();
     $colCount = count($this->referenceColumn);
     $newSpecTypes = [self::TYPE_IDENTIFIER];
     $values = [$this->referenceTable];
     $data[0][0] .= $this->referenceSpecification[0];
     if ($colCount) {
         $values = array_merge($values, $this->referenceColumn);
         $newSpecParts = array_fill(0, $colCount, '%s');
         $newSpecTypes = array_merge($newSpecTypes, array_fill(0, $colCount, self::TYPE_IDENTIFIER));
         $data[0][0] .= sprintf('(%s) ', implode(', ', $newSpecParts));
     }
     $data[0][0] .= $this->referenceSpecification[1];
     $values[] = $this->onDeleteRule;
     $values[] = $this->onUpdateRule;
     $newSpecTypes[] = self::TYPE_LITERAL;
     $newSpecTypes[] = self::TYPE_LITERAL;
     $data[0][1] = array_merge($data[0][1], $values);
     $data[0][2] = array_merge($data[0][2], $newSpecTypes);
     return $data;
 }
Example #8
0
 /**
  * Construct an instance of a InArrayConstraint.
  *
  * @param array $allowed
  */
 public function __construct(array $allowed)
 {
     parent::__construct();
     $this->allowed = $allowed;
 }
Example #9
0
 /**
  * @return	NotNull
  */
 public function __construct()
 {
     parent::__construct('not null');
 }
Example #10
0
 public function __construct($columns = null, $name = null)
 {
     parent::__construct($columns);
     $this->name = $name;
 }
Example #11
0
 /**
  * Create a PropertiesConstraint object.
  *
  * @see http://docs.marklogic.com/search:search#opt-constraint
  *
  * @param string $name Constraint name.
  */
 public function __construct($name)
 {
     parent::__construct($name);
 }
 public function getViolationPayload()
 {
     return array_merge(parent::getViolationPayload(), array('member_of' => $this->arguments));
 }