<?php

namespace Ciext\Model;

class TableModelFactory extends AbstractTableModel
{

    public function __construct($table, $pkey = null)
    {
        parent::__construct();

        $this->set_table($table);
        $this->set_pkey($pkey);
    }

    public static function create($table_name, $table_pkey = null)
    {
        return new TableModelFactory($table_name, $table_pkey);
    }

    public function set_table($table)
    {
        $this->table = $table;

        return $this;
    }

    public function set_pkey($pkey = null)
    {
        $this->pkey = (is_null($pkey)) ? 'id_' . $this->table : $pkey;

        return $this;
    }

}
