如何在Symfony 2.5和最新版本中安装DoctrineExtensions

时间:2014-11-14 07:13:20

标签: symfony doctrine doctrine-extensions

我需要在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

BUT! 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框架的正常专家。我希望你的帮助,我的朋友们!

1 个答案:

答案 0 :(得分: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

而是标签创建空格。