平台相关功能

I need to use GROUP_CONCAT function in my DQL.

Solution is to add custom function: 1, 2

But I need also to run my code on PostgreSQL database, so I need to implement STRING_AGG function too.

My question is:

How to implement DQL function(like JOIN_STR(expr ',')), rendered into GROUP_CONCAT on MySQL and into STRING_AGG on PostgreSQL?

In other words: what is correct way to determine current Platform from inside FunctionNode?

Hm, I found it via SqlWalker::getConnection:

  public function getSql(SqlWalker $sqlWalker)
  {
    $platform = $sqlWalker->getConnection()->getDatabasePlatform();
    switch ($platform->getName()) {
       case 'mysql': //...
    }
    // ... 
  }