0

我需要在 qb 中使用 mysql 函数,例如 DATE()、NOW()、FROM_UNIXTIME() 等。我正在阅读这个主题How to install Doctrine Extensions in a Symfony2 project。我做到了:

composer require "beberlei/DoctrineExtensions":"dev-master"

一切都变得正常:

Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing beberlei/doctrineextensions (dev-master 5e4ec9c)
Cloning 5e4ec9c3ec3434151e1c73144b4ab87ae30aefbc
etc...

Еhen 我做到了:

doctrine:
    orm:
      auto_generate_proxy_classes: %kernel.debug%
      entity_managers:
        default:
          auto_mapping: true
          dql:
            datetime_functions:
              MONTH: DoctrineExtensions\Query\Mysql\Month
              YEAR: DoctrineExtensions\Query\Mysql\Year

但!Symfony 为我返回此异常:

FileLoaderLoadException: Cannot import resource "/home/domain/www/domain.com/app/config/config.yml" from "/home/domain/www/domain.com/app/config/config_dev.yml". (A YAML file cannot contain tabs as indentation at line 106 (near " dql:").)

对不起我的英语,但在俄罗斯互联网领域没有 Symfony2 框架的普通专家。我希望你的帮助,我的朋友们!

4

1 回答 1

0

从你的错误:

A YAML file cannot contain tabs as indentation at line 106 (near " dql:")

您在此文件中有选项卡:

doctrine:
    orm:
      auto_generate_proxy_classes: %kernel.debug%
      entity_managers:
        default:
          auto_mapping: true
          dql:
            datetime_functions:
              MONTH: DoctrineExtensions\Query\Mysql\Month
              YEAR: DoctrineExtensions\Query\Mysql\Year

相反,制表符会创建空格。

于 2014-11-14T07:22:44.160 回答