Search code examples
symfonydoctrinedoctrine-extensions

How to install DoctrineExtensions in Symfony 2.5 and latest


I need use mysql functions in qb such as DATE(), NOW(), FROM_UNIXTIME() etc. I reading this topic How to install Doctrine Extensions in a Symfony2 project. I did it:

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

all became normal:

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

Еhen I did it:

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 return this exception for me:

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:").)

Sorry for my english, but in russia internet segment no normal specialists for Symfony2 framework. I hope for your help, my friends!


Solution

  • From your error:

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

    You have tabs in this file:

    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
    

    Instead tabs create spaces.