NilPortugues\Sql\QueryBuilder\Manipulation\Select::setFunctionAsColumn PHP Method

setFunctionAsColumn() public method

Allows calculation on columns using predefined SQL functions.
public setFunctionAsColumn ( string $funcName, array $arguments, string $alias ) : NilPortugues\Sql\QueryBuilder\Manipulation\ColumnQuery
$funcName string
$arguments array
$alias string
return NilPortugues\Sql\QueryBuilder\Manipulation\ColumnQuery
    public function setFunctionAsColumn($funcName, array $arguments, $alias)
    {
        return $this->columnQuery->setFunctionAsColumn($funcName, $arguments, $alias);
    }

Usage Example

 /**
  * @test
  */
 public function itShouldWriteFuncAsColumns()
 {
     $select = new Select('user');
     $select->setFunctionAsColumn('MAX', ['user_id'], 'max_value');
     $result = $this->columnWriter->writeFuncAsColumns($select);
     $this->assertInstanceOf('NilPortugues\\Sql\\QueryBuilder\\Syntax\\Column', $result[0]);
 }