private function parseField($objName, $searchableField) { $fieldAttribtues = $searchableField->attributes(); $name = $fieldAttribtues["name"]; $index = $fieldAttribtues["indexName"]; $type = $fieldAttribtues["type"]; $field = new IndexableField("{$name}", "{$index}", "{$type}"); $field->setGetter(isset($fieldAttribtues["getter"]) ? $fieldAttribtues["getter"] : preg_replace('/_(.?)/e', "strtoupper('\$1')", "{$name}")); if (isset($fieldAttribtues["nullable"])) { $field->setNullable($fieldAttribtues["nullable"] == "yes"); } if (isset($fieldAttribtues["orderable"])) { $field->setOrderable($fieldAttribtues["orderable"] == "yes"); } if (isset($fieldAttribtues["searchableonly"])) { $field->setSearchOnly($fieldAttribtues["searchableonly"] == "yes"); } if (isset($fieldAttribtues["skipField"])) { $field->setSkipField($fieldAttribtues["skipField"] == "yes"); } if (isset($fieldAttribtues["matchable"])) { $field->setMatchable($fieldAttribtues["matchable"] == "yes"); } if (isset($fieldAttribtues["indexEscapeType"])) { $field->setIndexEscapeType($fieldAttribtues["indexEscapeType"]); } if (isset($fieldAttribtues["searchEscapeType"])) { $field->setSearchEscapeType($fieldAttribtues["searchEscapeType"]); } if (isset($fieldAttribtues["keepCondition"])) { $field->setKeepCondition($fieldAttribtues["keepCondition"] == "yes"); } if (isset($fieldAttribtues["sphinxStringAttribute"])) { $sphinxType = $fieldAttribtues["sphinxStringAttribute"]; $field->setSphinxStringAttribute("{$sphinxType}"); } $this->searchableFields[$objName]["{$name}"] = $field; }
protected function parseField($objName, SimpleXMLElement $searchableField) { $fieldAttribtues = $searchableField->attributes(); $name = $this->tryXpath($searchableField, $fieldAttribtues["name"]); $index = $this->tryXpath($searchableField, $fieldAttribtues["indexName"]); $type = $this->tryXpath($searchableField, $fieldAttribtues["type"]); $field = new IndexableField("{$name}", "{$index}", "{$type}"); $field->setGetter(isset($fieldAttribtues["getter"]) ? $fieldAttribtues["getter"] : preg_replace('/_(.?)/e', "strtoupper('\$1')", "{$name}")); if (!isset($fieldAttribtues["getter"])) { $fieldAttribtues->addAttribute('getter', $field->getter); } // so we could use the getter in xpath even if it was not explicitly defined if (isset($fieldAttribtues["apiName"])) { $apiName = $this->tryXpath($searchableField, (string) $fieldAttribtues["apiName"]); $apiName = preg_replace('/_(.?)/e', "strtoupper('\$1')", $apiName); $field->setApiName($apiName); } if (isset($fieldAttribtues["nullable"])) { $field->setNullable($fieldAttribtues["nullable"] == "yes"); } if (isset($fieldAttribtues["orderable"])) { $field->setOrderable($fieldAttribtues["orderable"] == "yes"); } if (isset($fieldAttribtues["searchableonly"])) { $field->setSearchOnly($fieldAttribtues["searchableonly"] == "yes"); } if (isset($fieldAttribtues["skipField"])) { $field->setSkipField($fieldAttribtues["skipField"] == "yes"); } if (isset($fieldAttribtues["matchable"])) { $field->setMatchable($fieldAttribtues["matchable"] == "yes"); } if (isset($fieldAttribtues["indexEscapeType"])) { $field->setIndexEscapeType($fieldAttribtues["indexEscapeType"]); } if (isset($fieldAttribtues["searchEscapeType"])) { $field->setSearchEscapeType($fieldAttribtues["searchEscapeType"]); } if (isset($fieldAttribtues["keepCondition"])) { $field->setKeepCondition($fieldAttribtues["keepCondition"] == "yes"); } if (isset($fieldAttribtues["sphinxStringAttribute"])) { $sphinxType = $fieldAttribtues["sphinxStringAttribute"]; $field->setSphinxStringAttribute("{$sphinxType}"); } $this->searchableFields[$objName]["{$name}"] = $field; }