PHPackages                             devimteam/doctrine-extensions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. devimteam/doctrine-extensions

ActiveLibrary[Database &amp; ORM](/categories/database)

devimteam/doctrine-extensions
=============================

Doctrine Extensions for MySQL and PostgreSQL. Fork with bigint support

1.2.0(8y ago)02.2kMITPHPPHP &gt;=5.3.0

Since Jul 25Pushed 5y ago2 watchersCompare

[ Source](https://github.com/devimteam/doctrine-extensions)[ Packagist](https://packagist.org/packages/devimteam/doctrine-extensions)[ Docs](https://github.com/orocrm/doctrine-extensions/)[ RSS](/packages/devimteam-doctrine-extensions/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (26)Used By (0)

Oro Doctrine Extensions
=======================

[](#oro-doctrine-extensions)

[![Build Status](https://camo.githubusercontent.com/a6f1879a472296f71e02c4cc1c875ab15a4299952f2e9def0e287bdee3987f36/68747470733a2f2f7472617669732d63692e6f72672f6f726f696e632f646f637472696e652d657874656e73696f6e732e737667)](https://travis-ci.org/oroinc/doctrine-extensions)

Table of Contents
-----------------

[](#table-of-contents)

- [DQL Functions](#dql-functions-list)
    - [Installation](#installation)
    - [Functions Registration](#functions-registration)
        - [Doctrine2](#doctrine2)
        - [Symfony2](#symfony2)
        - [Silex](#silex)
        - [Zend Framework 2](#zend-framework-2)
    - [Extendability and Database Support](#extendability-and-database-support)
        - [Architecture](#architecture)
        - [Adding new platform](#adding-new-platform)
        - [Adding new function](#adding-new-function)
- [Field Types](#field-types)

DQL Functions
=============

[](#dql-functions)

This library provide set of cross database doctrine DQL functions. Supported databases are MySQL and PostgreSQL. Available functions:

- `DATE(expr)` - Extract the date part of a date or datetime expression
- `TIME(expr)` - Extract the time portion of the expression passed
- `TIMESTAMP(expr)` - Convert expression to TIMESTAMP
- `TIMESTAMPDIFF(unit, datetime_expr1, datetime_expr2)` - Returns *datetime\_expr2* – *datetime\_expr1*, where *datetime\_expr1* and *datetime\_expr2* are date or datetime expressions. The *unit* should be one of the following values: *MICROSECOND* (microseconds), *SECOND*, *MINUTE*, *HOUR*, *DAY*, *WEEK*, *MONTH*, *QUARTER*, or *YEAR*.
- `CONVERT_TZ(expr, from_tz, to_tz)` - Converts a datetime value expr from the time zone given by from\_tz to the time zone given by to\_tz and returns the resulting datetime value
- `DAY(expr)` - Return the day of the month (0-31)
- `DAYOFWEEK(expr)` - Returns the weekday index for date (1 = Sunday, 2 = Monday, …, 7 = Saturday). These index values correspond to the ODBC standard.
- `DAYOFMONTH(expr)` - Returns the day of the month for date, in the range 1 to 31, or 0 for dates such as '0000-00-00' or '2008-00-00' that have a zero day part.
- `DAYOFYEAR(expr)` - Return the day of the year (1-366)
- `HOUR(expr)` - Return the hour from the date passed
- `MD5(expr)` - Calculate MD5 checksum
- `MINUTE(expr)` - Return the minute from the date passed
- `MONTH(expr)` - Return the month from the date passed
- `QUARTER(expr)` - Return the quarter from the date passed
- `SECOND(expr)` - Return the second from the date passed
- `WEEK(expr)` - The number of the week of the year that the day is in. By definition (ISO 8601), weeks start on Mondays and the first week of a year contains January 4 of that year. In other words, the first Thursday of a year is in week 1 of that year.
- `YEAR(expr)` - Return the year from the date passed
- `POW(expr, power)` - Return the argument raised to the specified power
- `ROUND(value, precision)` - Return the value formated with the precision specified
- `SIGN(expr)` - Return the sign of the argument
- `CAST(expr as type)` - Takes an expression of any type and produces a result value of a specified type. Supported types are: "char, string, text, date, datetime, time, int, integer, decimal, boolean"
- `CONCAT_WS` - Concatenate all but the first argument with separators. The first argument is used as the separator string.
- `GROUP_CONCAT` - Return a concatenated string
- `REPLACE(subject,from,to)` - Replaces all occurrances of a string "from" with "to" within a string "subject"
- `DATE_FORMAT(date,format)` - Formats the date value according to the format string. The following specifiers may be used in the format string. The % character is required before format specifier characters.

SpecifierDescription%aAbbreviated weekday name (Sun..Sat)%bAbbreviated month name (Jan..Dec)%cMonth, numeric (0..12)%dDay of the month, numeric (00..31)%eDay of the month, numeric (0..31)%fMicroseconds (000000..999999)%HHour (00..23)%hHour (01..12)%IHour (01..12)%iMinutes, numeric (00..59)%jDay of year (001..366)%kHour (0..23)%lHour (1..12)%MMonth name (January..December)%mMonth, numeric (00..12)%pAM or PM%rTime, 12-hour (hh:mm:ss followed by AM or PM)%SSeconds (00..59)%sSeconds (00..59)%TTime, 24-hour (hh:mm:ss)%WWeekday name (Sunday..Saturday)%YYear, numeric, four digits%yYear, numeric (two digits)%%A literal % characterGROUP\_CONCAT full syntax:

```
GROUP_CONCAT([DISTINCT] expr [,expr ...]
            [ORDER BY {unsigned_integer | col_name | expr}
                [ASC | DESC] [,col_name ...]]
            [SEPARATOR str_val])

```

Installation
------------

[](#installation)

Add the following dependency to your composer.json

```
{
    "require": {
        "oro/doctrine-extensions": "dev-master"
    }
}
```

Functions Registration
----------------------

[](#functions-registration)

### Doctrine2

[](#doctrine2)

[Doctrine2 Documentation: "DQL User Defined Functions"](http://docs.doctrine-project.org/en/latest/cookbook/dql-user-defined-functions.html)

```
