/** * Pretty much the same as find(), just for counting beans * * @return int */ public function count() { if (empty($this->related)) { $r = $this->r->count($this->type, $this->makeQuery(), $this->params); } else { $r = 0; foreach ($this->related as $bean) { $r += $this->r->relatedCount($bean, $this->type, $this->makeQuery(), $this->params); } } $this->free(); return $r; }