public function search($search, $query) { $constraints = array(); $configuration = $this->configurationManager->getClassConfiguration($query->getType()); foreach ($configuration["properties"] as $property => $annotations) { if (isset($annotations["search"])) { $constraints[] = $query->like($property, "%" . $search . "%", false); } } $query->matching($query->logicalOr($constraints)); return $query; }
public function handleSearch() { if ($this->request->hasArgument("search")) { $search = $this->request->getArgument("search"); $configuration = $this->configurationManager->getClassConfiguration($this->query->getType()); $searchProviderClass = strval(current($configuration["searchProvider"])); $searchProvider = new $searchProviderClass(); $this->query = $searchProvider->search($search, $this->query); return $search; } else { return ""; } }
public function getStringByGuessing($source) { $configuration = $this->configurationManager->getClassConfiguration(get_class($source)); $goodGuess = array(); $usualSuspects = array("title", "name"); foreach ($configuration["properties"] as $property => $meta) { if (in_array($property, $usualSuspects)) { if (\TYPO3\FLOW3\Reflection\ObjectAccess::isPropertyGettable($source, $property)) { $value = \TYPO3\FLOW3\Reflection\ObjectAccess::getProperty($source, $property); if (is_object($value) && $this->nestingLevel < 3) { $this->nestingLevel++; $value = $this->convertFrom($value, "string"); $this->nestingLevel--; } if (!is_object($value) && !is_null($value)) { $goodGuess[] = $value; } } } } if (count($goodGuess) > 0) { return implode(", ", $goodGuess); } return false; }
public function setClass($class) { $this->class = $class; $configuration = $this->configurationManager->getClassConfiguration($class); foreach ($configuration as $key => $values) { switch ($key) { case 'properties': foreach ($values as $property => $value) { if ($this->shouldBeIgnored($value, $property)) { continue; } $p = new \Admin\Core\Property($property, $this); $p->setParent($this); $p->setConfiguration($value); $this->properties[$property] = $p; $this->{$property} = $p; } break; default: if (is_array($values) && count($values) == 1) { $this->{$key} = current($values); } else { $this->{$key} = $values; } break; } } }