/** * Concatenates an array of column names or values. * * Usage: * $query->select($query->concatenate(array('a', 'b'))); * * @param array $values An array of values to concatenate. * @param string $separator As separator to place between each value. * * @return string The concatenated values. * * @since 2.0 */ public function concatenate($values, $separator = null) { if ($separator) { return 'CONCATENATE(' . implode(' || ' . $this->query->quote($separator) . ' || ', $values) . ')'; } else { return 'CONCATENATE(' . implode(' || ', $values) . ')'; } }
/** * @param QueryInterface $query * @return $this * @throws \InvalidArgumentException */ public function registerQuery(QueryInterface $query) { $name = $query->getName(); if ($this->hasQuery($name)) { throw new \InvalidArgumentException(sprintf('Query "%s" is already registered!', $name)); } $this->queries[$name] = $query; return $this; }
/** * @param MessageInterface|QueryInterface $message * @return QueryHandlerInterface * @throws QueryBusException */ protected function getHandler(QueryInterface $message) { $messageName = $message->getName(); $handlerId = $this->resolver->resolve($messageName); if (!$this->locator->has($handlerId)) { throw new QueryBusException(sprintf("Cannot instantiate handler '%s' for query '%s'", $handlerId, $messageName)); } /** @var QueryHandlerInterface $handler */ $handler = $this->locator->get($handlerId); if (!$handler instanceof QueryHandlerInterface) { throw new QueryBusException(sprintf("Handler '%s' returned by locator for query '%s' should implement QueryHandlerInterface", $handlerId, $messageName)); } return $handler; }
/** * Find database record collection by column name and its value. * This is generic method that should be used in nested classes to find its * records by some its column values. * * @param QueryInterface $query Query object instance * @param string $columnName Column name for searching in calling class * @param mixed $columnValue Column value * @return self[] Record instance if it was found and 4th variable has NOT been passed, * NULL if record has NOT been found and 4th variable has NOT been passed * @deprecated Record should not be queryable, query class ancestor must be used */ public static function collectionByColumn(QueryInterface $query, $columnName, $columnValue) { // Perform db request and get materials return $query->className(get_called_class())->cond($columnName, $columnValue)->exec(); }
/** * @expectedException \PaynetEasy\PaynetEasyApi\Exception\ValidationException * @expectedExceptionMessage Response clientId 'invalid' does not match Payment clientId */ public function testProcessErrorResponseWithInvalidId() { $response = new Response(array('type' => 'error', 'client_orderid' => 'invalid')); $this->object->processResponse($this->getPaymentTransaction(), $response); }