Skip to content

morontt/doctrine-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

doctrine-functions

Additional DQL functions for Doctrine2

Numeric functions

Datetime functions

String functions

  • substr(string, from, count) ref

Installation

Just add the package to your composer.json

{
    "require": {
        "morontt/doctrine-functions": "dev-master"
    }
}

Integration

1) Doctrine Only

According to the Doctrine documentation you can register the functions in this package this way.

<?php
$config = new \Doctrine\ORM\Configuration();
$config->addCustomNumericFunction('rand', 'Morontt\DQL\Numeric\Rand');
?>

2) Using Symfony 2

With symfony 2 you can register you functions in the config.yml file.

doctrine:
    orm:
        entity_managers:
            default:
                dql:
                    numeric_functions:
                        rand: Morontt\DQL\Numeric\Rand
                    datetime_functions:
                        month: Morontt\DQL\DateTime\Month
                    string_functions:
                        substr: Morontt\DQL\String\Substr

About

Additional DQL functions for Doctrine2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages