CsvDefinition::__get PHP Method

__get() public method

Overwrite the magic __get function to retrieve the primary key parameter. This isn't a real parameter but a derived one from the tabularcolumns relation.
public __get ( $name )
    public function __get($name)
    {
        if ($name == 'pk') {
            // Retrieve the primary key from the columns
            // Get the related columns
            $columns = $this->tabularColumns()->getResults();
            foreach ($columns as $column) {
                if ($column->is_pk) {
                    return $column->index;
                }
            }
            return -1;
        }
        return parent::__get($name);
    }