我正在使用Symfony2和Doctrine 2开发应用程序。
技术规格
我正在使用Symfony 2.7.1
我正在使用PostgreSQl 1.18.1
我尝试使用名为oro-crm doctrine扩展名的包添加强制转换函数。我在app / config / config.yml中有这个:
dql:
datetime_functions:
date: Oro\ORM\Query\AST\Functions\SimpleFunction
time: Oro\ORM\Query\AST\Functions\SimpleFunction
timestamp: Oro\ORM\Query\AST\Functions\SimpleFunction
convert_tz: Oro\ORM\Query\AST\Functions\DateTime\ConvertTz
numeric_functions:
timestampdiff: Oro\ORM\Query\AST\Functions\Numeric\TimestampDiff
dayofyear: Oro\ORM\Query\AST\Functions\SimpleFunction
dayofmonth: Oro\ORM\Query\AST\Functions\SimpleFunction
dayofweek: Oro\ORM\Query\AST\Functions\SimpleFunction
week: Oro\ORM\Query\AST\Functions\SimpleFunction
day: Oro\ORM\Query\AST\Functions\SimpleFunction
hour: Oro\ORM\Query\AST\Functions\SimpleFunction
minute: Oro\ORM\Query\AST\Functions\SimpleFunction
month: Oro\ORM\Query\AST\Functions\SimpleFunction
quarter: Oro\ORM\Query\AST\Functions\SimpleFunction
second: Oro\ORM\Query\AST\Functions\SimpleFunction
year: Oro\ORM\Query\AST\Functions\SimpleFunction
sign: Oro\ORM\Query\AST\Functions\Numeric\Sign
pow: Oro\ORM\Query\AST\Functions\Numeric\Pow
string_functions:
group_concat: Oro\ORM\Query\AST\Functions\String\GroupConcat
concat_ws: Oro\ORM\Query\AST\Functions\String\ConcatWs
cast: Oro\ORM\Query\AST\Functions\Cast
这是/oro/doctrine-extensions/src/Oro/ORM/Query/AST/Functions/Cast.php的命名空间:
命名空间Oro \ ORM \ Query \ AST \ Functions;
我在symfony2 composer.json
中有"oro/doctrine-extensions":"dev-master"
嗯,问题在于,当我尝试使用此命令将配置添加到Doctrine时:
$config=$this->em->getConfiguration();
$config->addCustomStringFunction('CAST', 'Oro\ORM\Query\AST\Functions\Cast');
我收到了这个错误:
Attempted to load class "Cast" from namespace "Oro\ORM\Query\AST\Functions".
Did you forget a "use" statement for another namespace?