Skip to content

markitosgv/doctrine-functions-psql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doctrine Functions for PostgreSQL

This package contains doctrine functions for PostgreSQL.

List of available functions:

  • DAYOFWEEK(expr)
  • WEEK(expr)
  • DAYOFMONTH(expr)
  • DAYOFYEAR(expr)
  • HOUR(expr)
  • MINUTE(expr)
  • MONTH(expr)
  • QUARTER(expr)
  • SECOND(expr)
  • YEAR(expr)

Edit this file in your pull request to add your functions to the list.

Install

Via Composer

$ composer require gesdinet/doctrine-functions-psql

Usage

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->addCustomDatetimeFunction('year', 'Gesdinet\DQL\Datetime\Year');

$em = EntityManager::create($dbParams, $config);

2) Using Symfony 2

With Symfony 2 you can register your functions directly in the config.yml file.

doctrine:
    orm:
        dql:
            datetime_functions:
                month:     Gesdinet\DQL\Datetime\Month
                year:      Gesdinet\DQL\Datetime\Year
                # etc

Contributing

Feel free to make a PR with new functions and tests

Credits

Based on luxifer doctrine-functions for MySQL

License

The MIT License (MIT). Please see License File for more information.

About

Doctrine DQL Functions for PostgreSQL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages