OnlyColumn

Introduction #

Sometime you may want to simplify your data flow by taking only some of columns to continue in datapipe. You can do so with OnlyColumn process. This process will act like a filter which only let some specified columns passing through. Other columns will be discarded.

Example #

<?php
use \koolreport\processes\OnlyColumn;
class MyReport extends \koolreport\KoolReport
{
    public function setup()
    {
        ...
        ->pipe(new OnlyColumn(array(
            "customerName","orderAmount"
        )))
        ...
    }
}

Code explanation:

  1. In this example, we use OnlyColumn process with two columns name input "customerName" and "orderAmount".
  2. After data is piped though the OnlyColumn process, only data of two columns "customerName" and "orderAmount" are available.