Create Process

Structure of standard process #

class MyProcess extends \koolreport\processes\Process
{    
    
    /**
     * Process initiation
     * 
     * @return null
     */
    protected function onInit()
    {

    }

    /**
     * Handle on data input
     * 
     * @param array $data The input data row 
     * 
     * @return null
     */
    protected function onInput($row)
    {
        $this->next($row);
    }


    /**
     * This method will be called when source nodes sending start input signal
     * 
     * @return null
     */
    protected function onInputStart()
    {

    }

    /**
     * This method will be called when sources data is finishes
     * 
     * @return null
     */
    protected function onInputEnd()
    {

    }


    /**
     * This method will be called when node received meta data
     * 
     * @param array $metaData The passing meta data
     * 
     * @return array
     */
    protected function onMetaReceived($metaData)
    {
        return $metaData;
    }
}

List of events #

onInit() #

This method will be called after your process is initiated. Inside this method, you can do any preparation for your process. You may find the parameters passed to the process at $this->params.

onMetaReceived() #

onMetaReceived($metaData)

This method is called when process receives meta data sent from previous process. You will receive the $metaData as parameter, if you do not want to make any change, just return the $metaData to pass it on to the next process. In case you need some changes .. like adding new column, you may modify the $metaData and return it.

onInput() #

onInput($row)

This method will be called when the previous process sends a row of data. Inside this method, you can apply any change to the row and call $this->next($row) to pass row to the next process.

onInputStart() #

This method is called when the data pipe is about to send data. You can do whatever preparation here before data is sent to your process.

onInputEnd() #

This method is called when no more data is sent to your process.

Get started with KoolReport

KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.