PHPackages                             iakumai/doctrine-functions - 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. iakumai/doctrine-functions

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

iakumai/doctrine-functions
==========================

Doctrine DQL Functions for Mysql

32.9k3PHP

Since Jan 29Pushed 11y ago1 watchersCompare

[ Source](https://github.com/IAkumaI/doctrine-functions)[ Packagist](https://packagist.org/packages/iakumai/doctrine-functions)[ RSS](/packages/iakumai-doctrine-functions/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Doctrine Functions
==================

[](#doctrine-functions)

This package contains some doctrine functions

### String functions

[](#string-functions)

- `INSTR(exp1, exp2)` - [documentation](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_instr)
- `FIELD(exp1, exp2, exp3, exp4...)` - [documentation](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_field)

### DateTime functions

[](#datetime-functions)

- `DATE_FORMAT(field, '%format%')` - [documentation](http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format)
- `DATE(field)` - [documentation](http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date)

### Math functions

[](#math-functions)

- `RAND()` - [documentation](http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand). Remember, you can not use parameters in this function.
- `RANDP(12345)` - [documentation](http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand). This is still RAND() MySQL function, but you must use a number parameter in it.

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

[](#installation)

Just add the package to your `composer.json`

```
{
    "require": {
        "iakumai/doctrine-functions": "dev-master"
    }
}
```

Integration
-----------

[](#integration)

### 1) Doctrine Only

[](#1-doctrine-only)

According to the [Doctrine documentation](http://docs.doctrine-project.org/en/latest/cookbook/dql-user-defined-functions.html) you can register the functions in this package this way.

```
