public function getPrimary($need = TRUE) { if ($this->primary === NULL && $need) { throw new \LogicException("Table '{$this->name}' does not have a primary key."); } return $this->primary; }
/** * @return int */ public function getCount() { if ($this->count === NULL) { $column = !$this->source->getPrimary(FALSE) ? '*' : $this->source->getPrimary(); $this->count = $this->source->count($column); } return $this->count; }