/** * Perform a partial match on title of options * * @param Field $field * @param string $property Either 'title' or 'value' * @param string $operator * @param string $value Value to find * @return SelectableOptionArray * */ public function findOptionsByProperty(Field $field, $property, $operator, $value) { if ($operator == '=' || $operator == '!=') { // no need to use fulltext matching if operator is not a partial match operator return $this->getOptions($field, array($property => $value)); } $query = new DatabaseQuerySelect(); $query->select('*'); $query->from(self::optionsTable); $query->where("fields_id=:fields_id"); $query->bindValue(':fields_id', $field->id); $ft = new DatabaseQuerySelectFulltext($query); $ft->match(self::optionsTable, $property, $operator, $value); $result = $query->execute(); $options = new SelectableOptionArray(); $options->setField($field); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $option = $this->arrayToOption($row); $options->add($option); } $options->resetTrackChanges(); return $options; }