Пример #1
0
 /**
  * Constructor.
  *
  * @param string                   $alias  Table alias.
  * @param string                   $table  Table name.
  * @param string|array             $pk     Primary key.
  * @param DatabaseAdapterInterface $db     Database adapter.
  */
 public function __construct($alias, $table, $pk = 'id', DatabaseAdapterInterface $db = null)
 {
     $this->db = $db ?: AbstractDatabaseAdapter::getInstance();
     $this->pk = $pk ?: $alias . '.' . $pk;
     $this->tables = new DataSet();
     $this->addTable($alias, $table);
     $this->prepare();
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param   string                    $table  Table name.
  * @param   string|array              $pk     Primary key.
  * @param   DatabaseAdapterInterface  $db     Database adapter.
  */
 public function __construct($table = null, $pk = 'id', DatabaseAdapterInterface $db = null)
 {
     $this->db = $db ?: AbstractDatabaseAdapter::getInstance();
     parent::__construct($table, $pk);
 }