vendor/oro/doctrine-extensions/src/Oro/ORM/Query/AST/FunctionFactory.php line 24

Open in your IDE?
  1. <?php
  2. namespace Oro\ORM\Query\AST;
  3. use Doctrine\ORM\Query\QueryException;
  4. use Doctrine\Common\Inflector\Inflector;
  5. use Oro\ORM\Query\AST\Platform\Functions\PlatformFunctionNode;
  6. class FunctionFactory
  7. {
  8.     /**
  9.      * Create platform function node.
  10.      *
  11.      * @param string $platformName
  12.      * @param string $functionName
  13.      * @param array $parameters
  14.      * @throws \Doctrine\ORM\Query\QueryException
  15.      * @return PlatformFunctionNode
  16.      */
  17.     public static function create($platformName$functionName, array $parameters)
  18.     {
  19.         $className __NAMESPACE__
  20.             '\\Platform\\Functions\\'
  21.             Inflector::classify(strtolower($platformName))
  22.             . '\\'
  23.             Inflector::classify(strtolower($functionName));
  24.         if (!class_exists($className)) {
  25.             throw QueryException::syntaxError(
  26.                 sprintf(
  27.                     'Function "%s" does not supported for platform "%s"',
  28.                     $functionName,
  29.                     $platformName
  30.                 )
  31.             );
  32.         }
  33.         return new $className($parameters);
  34.     }
  35. }